github / github/codeql

cpp: how to use macro argument as dataflow sink

Ouverte
#21,824 3 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
CodeQL
Étoiles
10.1k
Forks
2.1k
Merge moyen
2 j 15 h
PR mergées (30 j)
141

Description

I would like to do something like this:
```codeql
predicate isSink(DataFlow::Node sink) {
exists(MacroInvocation m |
sink.asExpr() = m.getArgument(0)
and m.getTarget().getName() = "my_cool_macro"
)
}
```
But `getArgument` is not defined, and `getExpandedArgument` returns a string. Doing `sink.asExpr().toString() = m.getExpandedArgument(0)` returns zero matches.

How do I use macros in dataflow?

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Start with the CodeQL predicate in the issue and read the mentioned MacroInvocation, getArgument, and getExpandedArgument entry points. Determine how macro arguments can be represented as dataflow nodes, or whether this is unsupported, and document a working example or the limitation so the question has a definitive answer.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
cpp
Domaine
security
Type d'issue
Documentation
Difficulté
4/5
Temps estimé
3-5 jours
Activité
Calme
Clarté
À clarifier
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.