Skip to content

Commit d8a049f

Browse files
committed
C++: Accept test changes.
1 parent 7e6857d commit d8a049f

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

cpp/ql/test/query-tests/Security/CWE/CWE-193/InvalidPointerDeref.expected

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,12 @@ edges
181181
| test.cpp:833:37:833:39 | end | test.cpp:815:52:815:54 | end |
182182
| test.cpp:841:18:841:35 | call to malloc | test.cpp:842:3:842:20 | ... = ... |
183183
| test.cpp:848:20:848:37 | call to malloc | test.cpp:849:5:849:22 | ... = ... |
184+
| test.cpp:856:12:856:35 | call to malloc | test.cpp:857:16:857:29 | ... + ... |
185+
| test.cpp:856:12:856:35 | call to malloc | test.cpp:857:16:857:29 | ... + ... |
186+
| test.cpp:856:12:856:35 | call to malloc | test.cpp:860:5:860:11 | ... = ... |
187+
| test.cpp:857:16:857:29 | ... + ... | test.cpp:857:16:857:29 | ... + ... |
188+
| test.cpp:857:16:857:29 | ... + ... | test.cpp:860:5:860:11 | ... = ... |
189+
| test.cpp:857:16:857:29 | ... + ... | test.cpp:860:5:860:11 | ... = ... |
184190
nodes
185191
| test.cpp:4:15:4:33 | call to malloc | semmle.label | call to malloc |
186192
| test.cpp:5:15:5:22 | ... + ... | semmle.label | ... + ... |
@@ -307,6 +313,10 @@ nodes
307313
| test.cpp:842:3:842:20 | ... = ... | semmle.label | ... = ... |
308314
| test.cpp:848:20:848:37 | call to malloc | semmle.label | call to malloc |
309315
| test.cpp:849:5:849:22 | ... = ... | semmle.label | ... = ... |
316+
| test.cpp:856:12:856:35 | call to malloc | semmle.label | call to malloc |
317+
| test.cpp:857:16:857:29 | ... + ... | semmle.label | ... + ... |
318+
| test.cpp:857:16:857:29 | ... + ... | semmle.label | ... + ... |
319+
| test.cpp:860:5:860:11 | ... = ... | semmle.label | ... = ... |
310320
subpaths
311321
#select
312322
| test.cpp:6:14:6:15 | * ... | test.cpp:4:15:4:33 | call to malloc | test.cpp:6:14:6:15 | * ... | This read might be out of bounds, as the pointer might be equal to $@ + $@. | test.cpp:4:15:4:33 | call to malloc | call to malloc | test.cpp:5:19:5:22 | size | size |
@@ -344,3 +354,4 @@ subpaths
344354
| test.cpp:821:7:821:12 | ... = ... | test.cpp:793:14:793:32 | call to malloc | test.cpp:821:7:821:12 | ... = ... | This write might be out of bounds, as the pointer might be equal to $@ + $@. | test.cpp:793:14:793:32 | call to malloc | call to malloc | test.cpp:794:21:794:24 | size | size |
345355
| test.cpp:842:3:842:20 | ... = ... | test.cpp:841:18:841:35 | call to malloc | test.cpp:842:3:842:20 | ... = ... | This write might be out of bounds, as the pointer might be equal to $@ + $@. | test.cpp:841:18:841:35 | call to malloc | call to malloc | test.cpp:842:11:842:15 | index | index |
346356
| test.cpp:849:5:849:22 | ... = ... | test.cpp:848:20:848:37 | call to malloc | test.cpp:849:5:849:22 | ... = ... | This write might be out of bounds, as the pointer might be equal to $@ + $@. | test.cpp:848:20:848:37 | call to malloc | call to malloc | test.cpp:849:13:849:17 | index | index |
357+
| test.cpp:860:5:860:11 | ... = ... | test.cpp:856:12:856:35 | call to malloc | test.cpp:860:5:860:11 | ... = ... | This write might be out of bounds, as the pointer might be equal to $@ + $@. | test.cpp:856:12:856:35 | call to malloc | call to malloc | test.cpp:857:21:857:28 | ... + ... | ... + ... |

cpp/ql/test/query-tests/Security/CWE/CWE-193/test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -854,9 +854,9 @@ void test16_with_malloc(size_t index) {
854854

855855
void test_regression(size_t size) {
856856
int* p = (int*)MyMalloc(size + 1);
857-
int* chend = p + (size + 1);
857+
int* chend = p + (size + 1); // $ alloc=L856+1
858858

859859
if(p <= chend) {
860-
*p = 42; // BAD [NOT DETECTED]
860+
*p = 42; // $ deref=L860 // BAD
861861
}
862862
}

0 commit comments

Comments
 (0)