Skip to content

Commit fdc3052

Browse files
committed
C++: Add testcase with missing MaD support for resolving typedefs inside arrays.
1 parent 493e757 commit fdc3052

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,3 +230,10 @@ sourceCallables
230230
| tests.cpp:463:6:463:6 | x |
231231
| tests.cpp:464:36:464:36 | s |
232232
| tests.cpp:465:6:465:6 | y |
233+
| tests.cpp:469:7:469:9 | INT |
234+
| tests.cpp:471:5:471:17 | receive_array |
235+
| tests.cpp:471:23:471:23 | a |
236+
| tests.cpp:473:6:473:23 | test_receive_array |
237+
| tests.cpp:474:6:474:6 | x |
238+
| tests.cpp:475:6:475:10 | array |
239+
| tests.cpp:476:6:476:6 | y |

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ private class TestSummaries extends SummaryModelCsv {
9898
";;false;madCallArg0ReturnToReturnFirst;;;Argument[0].ReturnValue;ReturnValue.Field[first];value",
9999
";;false;madCallArg0WithValue;;;Argument[1];Argument[0].Parameter[0];value",
100100
";;false;madCallReturnValueIgnoreFunction;;;Argument[1];ReturnValue;value",
101-
";StructWithTypedefInParameter<T>;true;parameter_ref_to_return_ref;(const T &);;Argument[*0];ReturnValue[*];value"
101+
";StructWithTypedefInParameter<T>;true;parameter_ref_to_return_ref;(const T &);;Argument[*0];ReturnValue[*];value",
102+
";;false;receive_array;(int[20]);;Argument[*0];ReturnValue;taint"
102103
]
103104
}
104105
}

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,4 +464,15 @@ void test_parameter_ref_to_return_ref() {
464464
StructWithTypedefInParameter<int> s;
465465
int y = s.parameter_ref_to_return_ref(x);
466466
sink(y); // $ ir
467+
}
468+
469+
using INT = int;
470+
471+
int receive_array(INT a[20]); // $ MISSING: interpretElement
472+
473+
void test_receive_array() {
474+
int x = source();
475+
int array[10] = {x};
476+
int y = receive_array(array);
477+
sink(y); // $ MISSING: ir
467478
}

0 commit comments

Comments
 (0)