Skip to content

Commit 91d224e

Browse files
authored
Merge pull request #14623 from alexet/dataflow-fps
CPP: Add dataflow FP with output arguments
2 parents e2ef0dc + b8d45ae commit 91d224e

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

cpp/ql/test/library-tests/dataflow/dataflow-tests/dataflow-consistency.expected

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ postWithInFlow
4141
| example.c:26:9:26:9 | x [post update] | PostUpdateNode should not be the target of local flow. |
4242
| example.c:26:19:26:24 | coords [inner post update] | PostUpdateNode should not be the target of local flow. |
4343
| example.c:28:23:28:25 | pos [inner post update] | PostUpdateNode should not be the target of local flow. |
44+
| flowOut.cpp:5:5:5:12 | * ... [post update] | PostUpdateNode should not be the target of local flow. |
45+
| flowOut.cpp:5:6:5:12 | toTaint [inner post update] | PostUpdateNode should not be the target of local flow. |
46+
| flowOut.cpp:18:17:18:17 | x [inner post update] | PostUpdateNode should not be the target of local flow. |
4447
| globals.cpp:13:5:13:19 | flowTestGlobal1 [post update] | PostUpdateNode should not be the target of local flow. |
4548
| globals.cpp:23:5:23:19 | flowTestGlobal2 [post update] | PostUpdateNode should not be the target of local flow. |
4649
| lambdas.cpp:23:3:23:14 | v [post update] | PostUpdateNode should not be the target of local flow. |
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
int source();
2+
void sink(int);
3+
4+
void source_ref(int *toTaint) { // $ ir-def=*toTaint ast-def=toTaint
5+
*toTaint = source();
6+
}
7+
8+
9+
10+
void modify_copy(int* ptr) { // $ ast-def=ptr
11+
int deref = *ptr;
12+
int* other = &deref;
13+
source_ref(other);
14+
}
15+
16+
void test_output() {
17+
int x = 0;
18+
modify_copy(&x);
19+
sink(x); // $ SPURIOUS: ir
20+
}

0 commit comments

Comments
 (0)