Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a727255

Browse files
committed
C++: Add a couple more test cases and correct test models again.
1 parent c10f41b commit a727255

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

cpp/ql/test/library-tests/dataflow/models-as-data/taint.ql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ private class TestSources extends SourceModelCsv {
99
row =
1010
[
1111
";;false;localMadSource;;;ReturnValue;remote",
12-
";;false;remoteMadSource;;;ReturnValue;local",
13-
";;false;localMadSourceHasBody;;;ReturnValue;remote",
12+
";;false;remoteMadSource;;;ReturnValue;remote",
13+
";;false;localMadSourceVoid;;;ReturnValue;local",
14+
";;false;localMadSourceHasBody;;;ReturnValue;local",
1415
// TODO: remoteMadSourceIndirect
1516
";;false;remoteMadSourceArg0;;;Argument[0];remote",
1617
";;false;remoteMadSourceArg1;;;Argument[1];remote", ";;false;remoteMadSourceVar;;;;remote",

cpp/ql/test/library-tests/dataflow/models-as-data/tests.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ void sink(int val);
88
int localMadSource();
99
int remoteMadSource();
1010
int notASource();
11+
int localMadSourceVoid(void);
1112
int localMadSourceHasBody() { return 0; }
1213
int *remoteMadSourceIndirect();
1314
void remoteMadSourceArg0(int *x, int *y);
@@ -24,6 +25,7 @@ void test_sources() {
2425
sink(localMadSource()); // $ ir
2526
sink(remoteMadSource()); // $ ir
2627
sink(notASource());
28+
sink(localMadSourceVoid()); // $ ir
2729
sink(localMadSourceHasBody()); // $ ir
2830
sink(*remoteMadSourceIndirect()); // $ MISSING: ir
2931

@@ -37,6 +39,9 @@ void test_sources() {
3739
sink(d); // $ MISSING: ir
3840

3941
sink(remoteMadSourceVar); // $ MISSING: ir
42+
43+
int e = localMadSource();
44+
sink(e); // $ ir
4045
}
4146

4247
void remoteMadSourceParam0(int x)

0 commit comments

Comments
 (0)