Skip to content

Commit e145b81

Browse files
committed
C++: Accept test changes.
1 parent 109e45e commit e145b81

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ edges
228228
| test.cpp:732:16:732:26 | ... + ... | test.cpp:732:16:732:26 | ... + ... |
229229
| test.cpp:732:16:732:26 | ... + ... | test.cpp:733:5:733:12 | ... = ... |
230230
| test.cpp:732:16:732:26 | ... + ... | test.cpp:733:5:733:12 | ... = ... |
231-
| test.cpp:739:12:739:21 | new[] | test.cpp:742:5:742:16 | ... = ... |
232231
nodes
233232
| test.cpp:4:15:4:20 | call to malloc | semmle.label | call to malloc |
234233
| test.cpp:5:15:5:22 | ... + ... | semmle.label | ... + ... |
@@ -383,8 +382,6 @@ nodes
383382
| test.cpp:732:16:732:26 | ... + ... | semmle.label | ... + ... |
384383
| test.cpp:732:16:732:26 | ... + ... | semmle.label | ... + ... |
385384
| test.cpp:733:5:733:12 | ... = ... | semmle.label | ... = ... |
386-
| test.cpp:739:12:739:21 | new[] | semmle.label | new[] |
387-
| test.cpp:742:5:742:16 | ... = ... | semmle.label | ... = ... |
388385
subpaths
389386
#select
390387
| test.cpp:6:14:6:15 | * ... | test.cpp:4:15:4:20 | 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:20 | call to malloc | call to malloc | test.cpp:5:19:5:22 | size | size |
@@ -420,4 +417,3 @@ subpaths
420417
| test.cpp:701:15:701:16 | * ... | test.cpp:695:13:695:26 | new[] | test.cpp:701:15:701:16 | * ... | This read might be out of bounds, as the pointer might be equal to $@ + $@. | test.cpp:695:13:695:26 | new[] | new[] | test.cpp:696:19:696:22 | size | size |
421418
| test.cpp:706:12:706:13 | * ... | test.cpp:711:13:711:26 | new[] | test.cpp:706:12:706:13 | * ... | This read might be out of bounds, as the pointer might be equal to $@ + $@. | test.cpp:711:13:711:26 | new[] | new[] | test.cpp:712:19:712:22 | size | size |
422419
| test.cpp:733:5:733:12 | ... = ... | test.cpp:730:12:730:28 | new[] | test.cpp:733:5:733:12 | ... = ... | This write might be out of bounds, as the pointer might be equal to $@ + $@. | test.cpp:730:12:730:28 | new[] | new[] | test.cpp:732:21:732:25 | ... + ... | ... + ... |
423-
| test.cpp:742:5:742:16 | ... = ... | test.cpp:739:12:739:21 | new[] | test.cpp:742:5:742:16 | ... = ... | This write might be out of bounds, as the pointer might be equal to $@ + $@. | test.cpp:739:12:739:21 | new[] | new[] | test.cpp:742:7:742:11 | ... - ... | ... - ... |

cpp/ql/test/experimental/query-tests/Security/CWE/CWE-193/pointer-deref/test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,6 @@ void test37(unsigned long n)
739739
int *p = new int[n];
740740
for (unsigned long i = n; i != 0u; i--)
741741
{
742-
p[n - i] = 0; // $ alloc=L739 deref=L742 // GOOD [FALSE POSITIVE]
742+
p[n - i] = 0; // GOOD
743743
}
744744
}

cpp/ql/test/library-tests/ir/range-analysis/test.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,20 +99,20 @@ void gotoLoop(bool b1, bool b2)
9999
void test_sub(int x, int y, int n) {
100100
if(x > 0 && x < 500) {
101101
if(y > 0 && y < 10) {
102-
range(x - y); // $ range="<=InitializeParameter: x-1" range=<=498
102+
range(x - y); // $ range=<=498 range=>=-8
103103
}
104104

105105
if(n > 0 && n < 100) {
106106
for (int i = 0; i < n; i++)
107107
{
108-
range(n - i); // $ range=<=99 range="<=InitializeParameter: n | Store: n+0"
109-
range(i - n); // $ range="<=InitializeParameter: n | Store: n-2" range=<=97 range="<=Phi: i-1"
108+
range(n - i); // $ range=">=Phi: i-97" range=<=99 range=>=-97
109+
range(i - n); // $ range="<=Phi: i-1" range=">=Phi: i-99" range=<=97 range=>=-99
110110
}
111111

112112
for (int i = n; i != 0; i--)
113113
{
114114
range(n - i); // $ SPURIOUS: overflow=+
115-
range(i - n); // $ range="<=Phi: i-1" SPURIOUS: overflow=-
115+
range(i - n); // $ range=">=Phi: i-99"
116116
}
117117
}
118118
}

0 commit comments

Comments
 (0)