mirror of
https://github.com/github/codeql.git
synced 2026-04-24 16:25:15 +02:00
C++: Add a failing test.
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
void sink(int); // $ MISSING: ir
|
||||
void indirect_sink(int*); // $ MISSING: ir
|
||||
int source();
|
||||
|
||||
void test() {
|
||||
int x = source();
|
||||
sink(x);
|
||||
|
||||
int* p = &x;
|
||||
indirect_sink(p);
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
testFailures
|
||||
failures
|
||||
@@ -0,0 +1,16 @@
|
||||
import TestUtilities.dataflow.FlowTestCommon
|
||||
import semmle.code.cpp.dataflow.new.DataFlow
|
||||
|
||||
module ParamConfig implements DataFlow::ConfigSig {
|
||||
predicate isSource(DataFlow::Node source) { source.asExpr().(Call).getTarget().hasName("source") }
|
||||
|
||||
predicate isSink(DataFlow::Node sink) {
|
||||
sink.asParameter().getFunction().hasName("sink")
|
||||
or
|
||||
sink.asParameter(1).getFunction().hasName("indirect_sink")
|
||||
}
|
||||
}
|
||||
|
||||
module IRFlow = DataFlow::Global<ParamConfig>;
|
||||
|
||||
import MakeTest<IRFlowTest<IRFlow>>
|
||||
Reference in New Issue
Block a user