зеркало из https://github.com/github/codeql.git
C++: Fix indirection ambiguity in the test.
This commit is contained in:
Родитель
087d689997
Коммит
e3ce7c608b
|
@ -10,7 +10,8 @@ module IRTest {
|
|||
predicate isSource(DataFlow::Node source) {
|
||||
source instanceof FlowSource
|
||||
or
|
||||
source.asExpr().(FunctionCall).getTarget().getName() = ["source", "source2", "source3", "sourcePtr"]
|
||||
source.asExpr().(FunctionCall).getTarget().getName() =
|
||||
["source", "source2", "source3", "sourcePtr"]
|
||||
or
|
||||
source.asIndirectExpr(1).(FunctionCall).getTarget().getName() = "sourceIndirect"
|
||||
}
|
||||
|
@ -20,7 +21,7 @@ module IRTest {
|
|||
or
|
||||
exists(FunctionCall call |
|
||||
call.getTarget().getName() = "sink" and
|
||||
[sink.asExpr(), sink.asIndirectExpr()] = call.getAnArgument()
|
||||
sink.asExpr() = call.getAnArgument()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,14 +44,14 @@ void test_sources() {
|
|||
sink(localMadSourceVoid()); // $ ir
|
||||
sink(localMadSourceHasBody()); // $ ir
|
||||
|
||||
sink(sourceIndirect()); // $ SPURIOUS: ir
|
||||
sink(sourceIndirect());
|
||||
sink(*sourceIndirect()); // $ ir
|
||||
|
||||
int v = localMadSource();
|
||||
int *v_indirect = &v;
|
||||
int v_direct = *v_indirect;
|
||||
sink(v); // $ ir
|
||||
sink(v_indirect); // $ SPURIOUS: ir
|
||||
sink(v_indirect);
|
||||
sink(*v_indirect); // $ ir
|
||||
sink(v_direct); // $ ir
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче