github / github/codeql

cpp: how to use macro argument as dataflow sink

Aperta
#21,824 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
CodeQL
Stelle
10.1k
Fork
2.1k
Merge medio
2g 15h
PR unite (30g)
141

Descrizione

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?

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
cpp
Ambito
security
Tipo di issue
Documentazione
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Tranquilla
Chiarezza
Da chiarire
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.