Skip to content

Commit d1cf688

Browse files
committed
C++: Fix test function naming.
1 parent 78535dc commit d1cf688

File tree

2 files changed

+24
-23
lines changed

2 files changed

+24
-23
lines changed

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

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -546,9 +546,9 @@ edges
546546
| test.cpp:137:11:137:13 | arr indirection [begin] | test.cpp:137:15:137:19 | begin |
547547
| test.cpp:137:15:137:19 | begin | test.cpp:137:15:137:19 | Load |
548548
| test.cpp:141:10:141:19 | VariableAddress indirection [begin] | test.cpp:150:20:150:29 | Call indirection [begin] |
549-
| test.cpp:141:10:141:19 | VariableAddress indirection [begin] | test.cpp:180:18:180:27 | call to mk_array_p indirection [begin] |
549+
| test.cpp:141:10:141:19 | VariableAddress indirection [begin] | test.cpp:180:19:180:28 | call to mk_array_p indirection [begin] |
550550
| test.cpp:141:10:141:19 | VariableAddress indirection [end] | test.cpp:150:20:150:29 | Call indirection [end] |
551-
| test.cpp:141:10:141:19 | VariableAddress indirection [end] | test.cpp:180:18:180:27 | call to mk_array_p indirection [end] |
551+
| test.cpp:141:10:141:19 | VariableAddress indirection [end] | test.cpp:180:19:180:28 | call to mk_array_p indirection [end] |
552552
| test.cpp:143:5:143:29 | Store | test.cpp:143:10:143:14 | Load indirection [post update] [begin] |
553553
| test.cpp:143:10:143:14 | Load indirection [post update] [begin] | test.cpp:141:10:141:19 | VariableAddress indirection [begin] |
554554
| test.cpp:143:10:143:14 | Load indirection [post update] [begin] | test.cpp:144:16:144:18 | Load indirection [begin] |
@@ -579,12 +579,12 @@ edges
579579
| test.cpp:160:20:160:22 | Load indirection [begin] | test.cpp:160:25:160:29 | begin |
580580
| test.cpp:160:20:160:22 | Load indirection [begin] | test.cpp:160:48:160:48 | Load |
581581
| test.cpp:160:25:160:29 | begin | test.cpp:160:48:160:48 | Load |
582-
| test.cpp:165:28:165:30 | arr indirection [begin] | test.cpp:166:20:166:22 | Load indirection [begin] |
583-
| test.cpp:165:28:165:30 | arr indirection [begin] | test.cpp:170:20:170:22 | Load indirection [begin] |
584-
| test.cpp:165:28:165:30 | arr indirection [begin] | test.cpp:174:20:174:22 | Load indirection [begin] |
585-
| test.cpp:165:28:165:30 | arr indirection [end] | test.cpp:166:37:166:39 | Load indirection [end] |
586-
| test.cpp:165:28:165:30 | arr indirection [end] | test.cpp:170:37:170:39 | Load indirection [end] |
587-
| test.cpp:165:28:165:30 | arr indirection [end] | test.cpp:174:36:174:38 | Load indirection [end] |
582+
| test.cpp:165:29:165:31 | arr indirection [begin] | test.cpp:166:20:166:22 | Load indirection [begin] |
583+
| test.cpp:165:29:165:31 | arr indirection [begin] | test.cpp:170:20:170:22 | Load indirection [begin] |
584+
| test.cpp:165:29:165:31 | arr indirection [begin] | test.cpp:174:20:174:22 | Load indirection [begin] |
585+
| test.cpp:165:29:165:31 | arr indirection [end] | test.cpp:166:37:166:39 | Load indirection [end] |
586+
| test.cpp:165:29:165:31 | arr indirection [end] | test.cpp:170:37:170:39 | Load indirection [end] |
587+
| test.cpp:165:29:165:31 | arr indirection [end] | test.cpp:174:36:174:38 | Load indirection [end] |
588588
| test.cpp:166:20:166:22 | Load indirection [begin] | test.cpp:166:25:166:29 | begin |
589589
| test.cpp:166:20:166:22 | Load indirection [begin] | test.cpp:166:49:166:49 | Load |
590590
| test.cpp:166:25:166:29 | begin | test.cpp:166:49:166:49 | Load |
@@ -606,8 +606,9 @@ edges
606606
| test.cpp:174:41:174:43 | Load | test.cpp:171:9:171:14 | Store: ... = ... |
607607
| test.cpp:174:41:174:43 | Load | test.cpp:171:9:171:14 | Store: ... = ... |
608608
| test.cpp:174:41:174:43 | end | test.cpp:174:41:174:43 | Load |
609-
| test.cpp:180:18:180:27 | call to mk_array_p indirection [begin] | test.cpp:165:28:165:30 | arr indirection [begin] |
610-
| test.cpp:180:18:180:27 | call to mk_array_p indirection [end] | test.cpp:165:28:165:30 | arr indirection [end] |
609+
| test.cpp:180:19:180:28 | call to mk_array_p indirection [begin] | test.cpp:165:29:165:31 | arr indirection [begin] |
610+
| test.cpp:180:19:180:28 | call to mk_array_p indirection [end] | test.cpp:165:29:165:31 | arr indirection [end] |
611+
| test.cpp:188:15:188:20 | call to malloc | test.cpp:189:15:189:15 | Load |
611612
#select
612613
| test.cpp:6:14:6:15 | Load: * ... | test.cpp:4:15:4:20 | call to malloc | test.cpp:6:14:6:15 | Load: * ... | 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 |
613614
| test.cpp:8:14:8:21 | Load: * ... | test.cpp:4:15:4:20 | call to malloc | test.cpp:8:14:8:21 | Load: * ... | This read might be out of bounds, as the pointer might be equal to $@ + $@ + 1. | test.cpp:4:15:4:20 | call to malloc | call to malloc | test.cpp:5:19:5:22 | size | size |

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ void test1(int size) {
1212
char g = *(q - size - 1); // GOOD
1313
}
1414

15-
void test12(int size) {
15+
void test2(int size) {
1616
char* p = malloc(size);
1717
char* q = p + size - 1;
1818
char a = *q; // GOOD
@@ -24,7 +24,7 @@ void test12(int size) {
2424
char g = *(q - size - 1); // GOOD
2525
}
2626

27-
void test9(int size) {
27+
void test3(int size) {
2828
char* p = malloc(size + 1);
2929
char* q = p + (size + 1);
3030
char a = *q; // BAD
@@ -36,7 +36,7 @@ void test9(int size) {
3636
char g = *(q - size - 1); // GOOD
3737
}
3838

39-
void test10(int size) {
39+
void test4(int size) {
4040
char* p = malloc(size - 1);
4141
char* q = p + (size - 1);
4242
char a = *q; // BAD
@@ -55,7 +55,7 @@ char* mk_array(int size, char** end) {
5555
return begin;
5656
}
5757

58-
void test11(int size) {
58+
void test5(int size) {
5959
char* end;
6060
char* begin = mk_array(size, &end);
6161

@@ -85,7 +85,7 @@ array_t mk_array(int size) {
8585
return arr;
8686
}
8787

88-
void test2(int size) {
88+
void test6(int size) {
8989
array_t arr = mk_array(size);
9090

9191
for (char* p = arr.begin; p != arr.end; ++p) {
@@ -101,7 +101,7 @@ void test2(int size) {
101101
}
102102
}
103103

104-
void test3_callee(array_t arr) {
104+
void test7_callee(array_t arr) {
105105
for (char* p = arr.begin; p != arr.end; ++p) {
106106
*p = 0; // GOOD
107107
}
@@ -115,11 +115,11 @@ void test3_callee(array_t arr) {
115115
}
116116
}
117117

118-
void test3(int size) {
119-
test3_callee(mk_array(size));
118+
void test7(int size) {
119+
test7_callee(mk_array(size));
120120
}
121121

122-
void test4(int size) {
122+
void test8(int size) {
123123
array_t arr;
124124
char* p = malloc(size);
125125
arr.begin = p;
@@ -146,7 +146,7 @@ array_t *mk_array_p(int size) {
146146
return arr;
147147
}
148148

149-
void test5(int size) {
149+
void test9(int size) {
150150
array_t *arr = mk_array_p(size);
151151

152152
for (char* p = arr->begin; p != arr->end; ++p) {
@@ -162,7 +162,7 @@ void test5(int size) {
162162
}
163163
}
164164

165-
void test6_callee(array_t *arr) {
165+
void test10_callee(array_t *arr) {
166166
for (char* p = arr->begin; p != arr->end; ++p) {
167167
*p = 0; // GOOD
168168
}
@@ -176,6 +176,6 @@ void test6_callee(array_t *arr) {
176176
}
177177
}
178178

179-
void test6(int size) {
180-
test6_callee(mk_array_p(size));
179+
void test10(int size) {
180+
test10_callee(mk_array_p(size));
181181
}

0 commit comments

Comments
 (0)