From cc0371648b18815ff0d2a62aae33c240bbbfc825 Mon Sep 17 00:00:00 2001 From: Mathias Vorreiter Pedersen Date: Mon, 19 Dec 2022 18:35:25 +0000 Subject: [PATCH] C++: Accept test changes. --- .../AllocMultiplicationOverflow.expected | 12 ++++++++++++ .../dataflow-tests/dataflow-consistency.expected | 3 +++ .../library-tests/dataflow/dataflow-tests/test.cpp | 11 +++++++++++ .../dataflow/fields/partial-definition-diff.expected | 2 ++ .../dataflow/fields/partial-definition-ir.expected | 2 ++ .../dataflow/source-sink-tests/sources-and-sinks.cpp | 2 +- 6 files changed, 31 insertions(+), 1 deletion(-) diff --git a/cpp/ql/test/experimental/query-tests/Security/CWE/CWE-190/AllocMultiplicationOverflow/AllocMultiplicationOverflow.expected b/cpp/ql/test/experimental/query-tests/Security/CWE/CWE-190/AllocMultiplicationOverflow/AllocMultiplicationOverflow.expected index 34f77e67632..66c633eea49 100644 --- a/cpp/ql/test/experimental/query-tests/Security/CWE/CWE-190/AllocMultiplicationOverflow/AllocMultiplicationOverflow.expected +++ b/cpp/ql/test/experimental/query-tests/Security/CWE/CWE-190/AllocMultiplicationOverflow/AllocMultiplicationOverflow.expected @@ -6,6 +6,9 @@ edges | test.cpp:22:17:22:21 | ... * ... | test.cpp:23:33:23:37 | size1 | | test.cpp:37:24:37:27 | size | test.cpp:37:46:37:49 | size | | test.cpp:45:36:45:40 | ... * ... | test.cpp:37:24:37:27 | size | +| test.cpp:45:36:45:40 | ... * ... | test.cpp:45:36:45:40 | ... * ... | +| test.cpp:45:36:45:40 | ... * ... | test.cpp:45:36:45:40 | ... * ... | +| test.cpp:46:36:46:40 | ... * ... | test.cpp:46:36:46:40 | ... * ... | nodes | test.cpp:13:33:13:37 | ... * ... | semmle.label | ... * ... | | test.cpp:13:33:13:37 | ... * ... | semmle.label | ... * ... | @@ -25,6 +28,10 @@ nodes | test.cpp:37:46:37:49 | size | semmle.label | size | | test.cpp:45:36:45:40 | ... * ... | semmle.label | ... * ... | | test.cpp:45:36:45:40 | ... * ... | semmle.label | ... * ... | +| test.cpp:45:36:45:40 | ... * ... | semmle.label | ... * ... | +| test.cpp:45:36:45:40 | ... * ... | semmle.label | ... * ... | +| test.cpp:46:36:46:40 | ... * ... | semmle.label | ... * ... | +| test.cpp:46:36:46:40 | ... * ... | semmle.label | ... * ... | | test.cpp:46:36:46:40 | ... * ... | semmle.label | ... * ... | subpaths #select @@ -42,5 +49,10 @@ subpaths | test.cpp:30:27:30:31 | ... * ... | test.cpp:30:27:30:31 | ... * ... | test.cpp:30:27:30:31 | ... * ... | Potentially overflowing value from $@ is used in the size of this allocation. | test.cpp:30:27:30:31 | ... * ... | multiplication | | test.cpp:31:27:31:31 | ... * ... | test.cpp:31:27:31:31 | ... * ... | test.cpp:31:27:31:31 | ... * ... | Potentially overflowing value from $@ is used in the size of this allocation. | test.cpp:31:27:31:31 | ... * ... | multiplication | | test.cpp:37:46:37:49 | size | test.cpp:45:36:45:40 | ... * ... | test.cpp:37:46:37:49 | size | Potentially overflowing value from $@ is used in the size of this allocation. | test.cpp:45:36:45:40 | ... * ... | multiplication | +| test.cpp:37:46:37:49 | size | test.cpp:45:36:45:40 | ... * ... | test.cpp:37:46:37:49 | size | Potentially overflowing value from $@ is used in the size of this allocation. | test.cpp:45:36:45:40 | ... * ... | multiplication | +| test.cpp:45:36:45:40 | ... * ... | test.cpp:45:36:45:40 | ... * ... | test.cpp:45:36:45:40 | ... * ... | Potentially overflowing value from $@ is used in the size of this allocation. | test.cpp:45:36:45:40 | ... * ... | multiplication | +| test.cpp:45:36:45:40 | ... * ... | test.cpp:45:36:45:40 | ... * ... | test.cpp:45:36:45:40 | ... * ... | Potentially overflowing value from $@ is used in the size of this allocation. | test.cpp:45:36:45:40 | ... * ... | multiplication | | test.cpp:45:36:45:40 | ... * ... | test.cpp:45:36:45:40 | ... * ... | test.cpp:45:36:45:40 | ... * ... | Potentially overflowing value from $@ is used in the size of this allocation. | test.cpp:45:36:45:40 | ... * ... | multiplication | | test.cpp:46:36:46:40 | ... * ... | test.cpp:46:36:46:40 | ... * ... | test.cpp:46:36:46:40 | ... * ... | Potentially overflowing value from $@ is used in the size of this allocation. | test.cpp:46:36:46:40 | ... * ... | multiplication | +| test.cpp:46:36:46:40 | ... * ... | test.cpp:46:36:46:40 | ... * ... | test.cpp:46:36:46:40 | ... * ... | Potentially overflowing value from $@ is used in the size of this allocation. | test.cpp:46:36:46:40 | ... * ... | multiplication | +| test.cpp:46:36:46:40 | ... * ... | test.cpp:46:36:46:40 | ... * ... | test.cpp:46:36:46:40 | ... * ... | Potentially overflowing value from $@ is used in the size of this allocation. | test.cpp:46:36:46:40 | ... * ... | multiplication | diff --git a/cpp/ql/test/library-tests/dataflow/dataflow-tests/dataflow-consistency.expected b/cpp/ql/test/library-tests/dataflow/dataflow-tests/dataflow-consistency.expected index 9f9100bcf25..67396c64e65 100644 --- a/cpp/ql/test/library-tests/dataflow/dataflow-tests/dataflow-consistency.expected +++ b/cpp/ql/test/library-tests/dataflow/dataflow-tests/dataflow-consistency.expected @@ -96,6 +96,9 @@ postWithInFlow | test.cpp:519:3:519:15 | access to array [post update] | PostUpdateNode should not be the target of local flow. | | test.cpp:520:3:520:12 | stackArray [inner post update] | PostUpdateNode should not be the target of local flow. | | test.cpp:520:3:520:15 | access to array [post update] | PostUpdateNode should not be the target of local flow. | +| test.cpp:526:3:526:4 | * ... [post update] | PostUpdateNode should not be the target of local flow. | +| test.cpp:526:4:526:4 | e [inner post update] | PostUpdateNode should not be the target of local flow. | +| test.cpp:531:40:531:40 | e [inner post update] | PostUpdateNode should not be the target of local flow. | viableImplInCallContextTooLarge uniqueParameterNodeAtPosition uniqueParameterNodePosition diff --git a/cpp/ql/test/library-tests/dataflow/dataflow-tests/test.cpp b/cpp/ql/test/library-tests/dataflow/dataflow-tests/test.cpp index a14d61ae780..14aefdce2d3 100644 --- a/cpp/ql/test/library-tests/dataflow/dataflow-tests/test.cpp +++ b/cpp/ql/test/library-tests/dataflow/dataflow-tests/test.cpp @@ -519,4 +519,15 @@ void uncertain_definition() { stackArray[0] = source(); stackArray[1] = clean; sink(stackArray[0]); // $ ast=519:19 ir SPURIOUS: ast=517:7 +} + +void set_through_const_pointer(int x, const int **e) +{ + *e = &x; +} + +void test_set_through_const_pointer(int *e) +{ + set_through_const_pointer(source(), &e); + sink(*e); // $ ir MISSING: ast } \ No newline at end of file diff --git a/cpp/ql/test/library-tests/dataflow/fields/partial-definition-diff.expected b/cpp/ql/test/library-tests/dataflow/fields/partial-definition-diff.expected index 045b2442898..fae1d16eb46 100644 --- a/cpp/ql/test/library-tests/dataflow/fields/partial-definition-diff.expected +++ b/cpp/ql/test/library-tests/dataflow/fields/partial-definition-diff.expected @@ -153,6 +153,8 @@ | by_reference.cpp:16:11:16:11 | a | AST only | | by_reference.cpp:32:15:32:15 | s | IR only | | by_reference.cpp:36:18:36:18 | this | IR only | +| by_reference.cpp:44:26:44:29 | this | IR only | +| by_reference.cpp:69:22:69:23 | & ... | IR only | | by_reference.cpp:84:10:84:10 | a | AST only | | by_reference.cpp:88:9:88:9 | a | AST only | | by_reference.cpp:92:3:92:5 | * ... | AST only | diff --git a/cpp/ql/test/library-tests/dataflow/fields/partial-definition-ir.expected b/cpp/ql/test/library-tests/dataflow/fields/partial-definition-ir.expected index e1055e08077..f2a6183b4a5 100644 --- a/cpp/ql/test/library-tests/dataflow/fields/partial-definition-ir.expected +++ b/cpp/ql/test/library-tests/dataflow/fields/partial-definition-ir.expected @@ -333,6 +333,7 @@ | by_reference.cpp:32:12:32:12 | s | | by_reference.cpp:36:12:36:15 | this | | by_reference.cpp:40:12:40:15 | this | +| by_reference.cpp:44:26:44:29 | this | | by_reference.cpp:50:3:50:3 | s | | by_reference.cpp:50:17:50:26 | call to user_input | | by_reference.cpp:51:8:51:8 | s | @@ -348,6 +349,7 @@ | by_reference.cpp:68:17:68:18 | & ... | | by_reference.cpp:68:21:68:30 | call to user_input | | by_reference.cpp:69:8:69:20 | call to nonMemberGetA | +| by_reference.cpp:69:22:69:23 | & ... | | by_reference.cpp:84:3:84:7 | inner | | by_reference.cpp:88:3:88:7 | inner | | by_reference.cpp:102:21:102:39 | & ... | diff --git a/cpp/ql/test/library-tests/dataflow/source-sink-tests/sources-and-sinks.cpp b/cpp/ql/test/library-tests/dataflow/source-sink-tests/sources-and-sinks.cpp index 35874af68c7..f51d67e5335 100644 --- a/cpp/ql/test/library-tests/dataflow/source-sink-tests/sources-and-sinks.cpp +++ b/cpp/ql/test/library-tests/dataflow/source-sink-tests/sources-and-sinks.cpp @@ -23,7 +23,7 @@ int readv(int, const struct iovec*, int); int writev(int, const struct iovec*, int); void test_readv_and_writev(iovec* iovs) { - readv(0, iovs, 16); // $ MISSING: remote_source + readv(0, iovs, 16); // $ remote_source writev(0, iovs, 16); // $ remote_sink }