github / github/codeql

cpp: how to use macro argument as dataflow sink

未关闭
#21,824 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
CodeQL
星标
10.1k
派生
2.1k
平均合并
2 天 15 小时
30 天内合并 PR
141

描述

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?

贡献指南

打开贡献指南

调研方向

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.

由索引模型根据 Issue 内容生成。

评估

技术栈
cpp
领域
security
Issue 类型
文档
难度
4/5
预计耗时
3-5 天
活跃度
冷清
描述清晰度
需要澄清
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。