Skip to content

Commit 7549915

Browse files
committed
C++: Accept test changes
1 parent a73bd05 commit 7549915

File tree

6 files changed

+35
-36
lines changed

6 files changed

+35
-36
lines changed
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
edges
2-
| test.c:9:23:9:26 | argv | test.c:17:11:17:18 | fileName indirection |
3-
| test.c:31:22:31:25 | argv | test.c:32:11:32:18 | fileName indirection |
2+
| test.c:8:27:8:30 | argv | test.c:17:11:17:18 | fileName indirection |
3+
| test.c:8:27:8:30 | argv | test.c:32:11:32:18 | fileName indirection |
44
| test.c:37:17:37:24 | scanf output argument | test.c:38:11:38:18 | fileName indirection |
55
| test.c:43:17:43:24 | scanf output argument | test.c:44:11:44:18 | fileName indirection |
66
nodes
7-
| test.c:9:23:9:26 | argv | semmle.label | argv |
7+
| test.c:8:27:8:30 | argv | semmle.label | argv |
88
| test.c:17:11:17:18 | fileName indirection | semmle.label | fileName indirection |
9-
| test.c:31:22:31:25 | argv | semmle.label | argv |
109
| test.c:32:11:32:18 | fileName indirection | semmle.label | fileName indirection |
1110
| test.c:37:17:37:24 | scanf output argument | semmle.label | scanf output argument |
1211
| test.c:38:11:38:18 | fileName indirection | semmle.label | fileName indirection |
1312
| test.c:43:17:43:24 | scanf output argument | semmle.label | scanf output argument |
1413
| test.c:44:11:44:18 | fileName indirection | semmle.label | fileName indirection |
1514
subpaths
1615
#select
17-
| test.c:17:11:17:18 | fileName | test.c:9:23:9:26 | argv | test.c:17:11:17:18 | fileName indirection | This argument to a file access function is derived from $@ and then passed to fopen(filename). | test.c:9:23:9:26 | argv | user input (a command-line argument) |
18-
| test.c:32:11:32:18 | fileName | test.c:31:22:31:25 | argv | test.c:32:11:32:18 | fileName indirection | This argument to a file access function is derived from $@ and then passed to fopen(filename). | test.c:31:22:31:25 | argv | user input (a command-line argument) |
16+
| test.c:17:11:17:18 | fileName | test.c:8:27:8:30 | argv | test.c:17:11:17:18 | fileName indirection | This argument to a file access function is derived from $@ and then passed to fopen(filename). | test.c:8:27:8:30 | argv | user input (a command-line argument) |
17+
| test.c:32:11:32:18 | fileName | test.c:8:27:8:30 | argv | test.c:32:11:32:18 | fileName indirection | This argument to a file access function is derived from $@ and then passed to fopen(filename). | test.c:8:27:8:30 | argv | user input (a command-line argument) |
1918
| test.c:38:11:38:18 | fileName | test.c:37:17:37:24 | scanf output argument | test.c:38:11:38:18 | fileName indirection | This argument to a file access function is derived from $@ and then passed to fopen(filename). | test.c:37:17:37:24 | scanf output argument | user input (value read by scanf) |
2019
| test.c:44:11:44:18 | fileName | test.c:43:17:43:24 | scanf output argument | test.c:44:11:44:18 | fileName indirection | This argument to a file access function is derived from $@ and then passed to fopen(filename). | test.c:43:17:43:24 | scanf output argument | user input (value read by scanf) |

cpp/ql/test/query-tests/Security/CWE/CWE-078/semmle/ExecTainted/ExecTainted.expected

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
edges
2-
| test.cpp:16:20:16:23 | argv | test.cpp:22:45:22:52 | userName indirection |
2+
| test.cpp:15:27:15:30 | argv | test.cpp:22:45:22:52 | userName indirection |
33
| test.cpp:22:13:22:20 | sprintf output argument | test.cpp:23:12:23:19 | command1 indirection |
44
| test.cpp:22:45:22:52 | userName indirection | test.cpp:22:13:22:20 | sprintf output argument |
55
| test.cpp:47:21:47:26 | call to getenv | test.cpp:50:35:50:43 | envCflags indirection |
@@ -74,7 +74,7 @@ edges
7474
| test.cpp:220:19:220:26 | filename indirection | test.cpp:220:10:220:16 | strncat output argument |
7575
| test.cpp:220:19:220:26 | filename indirection | test.cpp:220:10:220:16 | strncat output argument |
7676
nodes
77-
| test.cpp:16:20:16:23 | argv | semmle.label | argv |
77+
| test.cpp:15:27:15:30 | argv | semmle.label | argv |
7878
| test.cpp:22:13:22:20 | sprintf output argument | semmle.label | sprintf output argument |
7979
| test.cpp:22:45:22:52 | userName indirection | semmle.label | userName indirection |
8080
| test.cpp:23:12:23:19 | command1 indirection | semmle.label | command1 indirection |
@@ -161,7 +161,7 @@ subpaths
161161
| test.cpp:196:26:196:33 | filename indirection | test.cpp:186:47:186:54 | *filename | test.cpp:188:11:188:17 | command [post update] | test.cpp:196:10:196:16 | command [post update] |
162162
| test.cpp:196:26:196:33 | filename indirection | test.cpp:186:47:186:54 | *filename | test.cpp:188:11:188:17 | command [post update] | test.cpp:196:10:196:16 | command [post update] |
163163
#select
164-
| test.cpp:23:12:23:19 | command1 | test.cpp:16:20:16:23 | argv | test.cpp:23:12:23:19 | command1 indirection | This argument to an OS command is derived from $@, dangerously concatenated into $@, and then passed to system(string). | test.cpp:16:20:16:23 | argv | user input (a command-line argument) | test.cpp:22:13:22:20 | sprintf output argument | sprintf output argument |
164+
| test.cpp:23:12:23:19 | command1 | test.cpp:15:27:15:30 | argv | test.cpp:23:12:23:19 | command1 indirection | This argument to an OS command is derived from $@, dangerously concatenated into $@, and then passed to system(string). | test.cpp:15:27:15:30 | argv | user input (a command-line argument) | test.cpp:22:13:22:20 | sprintf output argument | sprintf output argument |
165165
| test.cpp:51:10:51:16 | command | test.cpp:47:21:47:26 | call to getenv | test.cpp:51:10:51:16 | command indirection | This argument to an OS command is derived from $@, dangerously concatenated into $@, and then passed to system(string). | test.cpp:47:21:47:26 | call to getenv | user input (an environment variable) | test.cpp:50:11:50:17 | sprintf output argument | sprintf output argument |
166166
| test.cpp:65:10:65:16 | command | test.cpp:62:9:62:16 | fread output argument | test.cpp:65:10:65:16 | command indirection | This argument to an OS command is derived from $@, dangerously concatenated into $@, and then passed to system(string). | test.cpp:62:9:62:16 | fread output argument | user input (string read by fread) | test.cpp:64:11:64:17 | strncat output argument | strncat output argument |
167167
| test.cpp:85:32:85:38 | command | test.cpp:82:9:82:16 | fread output argument | test.cpp:85:32:85:38 | command indirection | This argument to an OS command is derived from $@, dangerously concatenated into $@, and then passed to execl. | test.cpp:82:9:82:16 | fread output argument | user input (string read by fread) | test.cpp:84:11:84:17 | strncat output argument | strncat output argument |

cpp/ql/test/query-tests/Security/CWE/CWE-119/semmle/tests/OverflowDestination.expected

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
edges
2-
| main.cpp:7:33:7:36 | argv | main.cpp:7:33:7:36 | argv |
3-
| main.cpp:7:33:7:36 | argv | main.cpp:7:33:7:36 | argv indirection |
2+
| main.cpp:6:27:6:30 | argv | main.cpp:7:33:7:36 | argv |
3+
| main.cpp:6:27:6:30 | argv | main.cpp:7:33:7:36 | argv indirection |
44
| main.cpp:7:33:7:36 | argv | overflowdestination.cpp:23:45:23:48 | argv |
55
| main.cpp:7:33:7:36 | argv indirection | overflowdestination.cpp:23:45:23:48 | *argv |
66
| overflowdestination.cpp:23:45:23:48 | *argv | overflowdestination.cpp:30:17:30:20 | (const char *)... |
@@ -22,7 +22,7 @@ edges
2222
| overflowdestination.cpp:76:30:76:32 | src | overflowdestination.cpp:57:52:57:54 | src |
2323
| overflowdestination.cpp:76:30:76:32 | src indirection | overflowdestination.cpp:57:52:57:54 | *src |
2424
nodes
25-
| main.cpp:7:33:7:36 | argv | semmle.label | argv |
25+
| main.cpp:6:27:6:30 | argv | semmle.label | argv |
2626
| main.cpp:7:33:7:36 | argv | semmle.label | argv |
2727
| main.cpp:7:33:7:36 | argv indirection | semmle.label | argv indirection |
2828
| overflowdestination.cpp:23:45:23:48 | *argv | semmle.label | *argv |
@@ -46,7 +46,7 @@ nodes
4646
subpaths
4747
| overflowdestination.cpp:75:30:75:32 | src indirection | overflowdestination.cpp:50:52:50:54 | *src | overflowdestination.cpp:50:52:50:54 | ReturnIndirection | overflowdestination.cpp:75:30:75:32 | overflowdest_test2 output argument |
4848
#select
49-
| overflowdestination.cpp:30:2:30:8 | call to strncpy | main.cpp:7:33:7:36 | argv | overflowdestination.cpp:30:17:30:20 | (const char *)... | To avoid overflow, this operation should be bounded by destination-buffer size, not source-buffer size. |
49+
| overflowdestination.cpp:30:2:30:8 | call to strncpy | main.cpp:6:27:6:30 | argv | overflowdestination.cpp:30:17:30:20 | (const char *)... | To avoid overflow, this operation should be bounded by destination-buffer size, not source-buffer size. |
5050
| overflowdestination.cpp:46:2:46:7 | call to memcpy | overflowdestination.cpp:43:8:43:10 | fgets output argument | overflowdestination.cpp:46:15:46:17 | (const void *)... | To avoid overflow, this operation should be bounded by destination-buffer size, not source-buffer size. |
5151
| overflowdestination.cpp:53:2:53:7 | call to memcpy | overflowdestination.cpp:73:8:73:10 | fgets output argument | overflowdestination.cpp:53:15:53:17 | (const void *)... | To avoid overflow, this operation should be bounded by destination-buffer size, not source-buffer size. |
5252
| overflowdestination.cpp:64:2:64:7 | call to memcpy | overflowdestination.cpp:73:8:73:10 | fgets output argument | overflowdestination.cpp:64:16:64:19 | (const void *)... | To avoid overflow, this operation should be bounded by destination-buffer size, not source-buffer size. |
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
edges
2-
| test1.c:8:16:8:19 | argv | test1.c:9:9:9:9 | i |
3-
| test1.c:8:16:8:19 | argv | test1.c:11:9:11:9 | i |
4-
| test1.c:8:16:8:19 | argv | test1.c:13:9:13:9 | i |
2+
| test1.c:7:26:7:29 | argv | test1.c:9:9:9:9 | i |
3+
| test1.c:7:26:7:29 | argv | test1.c:11:9:11:9 | i |
4+
| test1.c:7:26:7:29 | argv | test1.c:13:9:13:9 | i |
55
| test1.c:9:9:9:9 | i | test1.c:16:16:16:16 | i |
66
| test1.c:11:9:11:9 | i | test1.c:32:16:32:16 | i |
77
| test1.c:13:9:13:9 | i | test1.c:48:16:48:16 | i |
88
| test1.c:16:16:16:16 | i | test1.c:18:16:18:16 | i |
99
| test1.c:32:16:32:16 | i | test1.c:33:11:33:11 | i |
1010
| test1.c:48:16:48:16 | i | test1.c:53:15:53:15 | j |
1111
nodes
12-
| test1.c:8:16:8:19 | argv | semmle.label | argv |
12+
| test1.c:7:26:7:29 | argv | semmle.label | argv |
1313
| test1.c:9:9:9:9 | i | semmle.label | i |
1414
| test1.c:11:9:11:9 | i | semmle.label | i |
1515
| test1.c:13:9:13:9 | i | semmle.label | i |
@@ -21,6 +21,6 @@ nodes
2121
| test1.c:53:15:53:15 | j | semmle.label | j |
2222
subpaths
2323
#select
24-
| test1.c:18:16:18:16 | i | test1.c:8:16:8:19 | argv | test1.c:18:16:18:16 | i | An array indexing expression depends on $@ that might be outside the bounds of the array. | test1.c:8:16:8:19 | argv | a command-line argument |
25-
| test1.c:33:11:33:11 | i | test1.c:8:16:8:19 | argv | test1.c:33:11:33:11 | i | An array indexing expression depends on $@ that might be outside the bounds of the array. | test1.c:8:16:8:19 | argv | a command-line argument |
26-
| test1.c:53:15:53:15 | j | test1.c:8:16:8:19 | argv | test1.c:53:15:53:15 | j | An array indexing expression depends on $@ that might be outside the bounds of the array. | test1.c:8:16:8:19 | argv | a command-line argument |
24+
| test1.c:18:16:18:16 | i | test1.c:7:26:7:29 | argv | test1.c:18:16:18:16 | i | An array indexing expression depends on $@ that might be outside the bounds of the array. | test1.c:7:26:7:29 | argv | a command-line argument |
25+
| test1.c:33:11:33:11 | i | test1.c:7:26:7:29 | argv | test1.c:33:11:33:11 | i | An array indexing expression depends on $@ that might be outside the bounds of the array. | test1.c:7:26:7:29 | argv | a command-line argument |
26+
| test1.c:53:15:53:15 | j | test1.c:7:26:7:29 | argv | test1.c:53:15:53:15 | j | An array indexing expression depends on $@ that might be outside the bounds of the array. | test1.c:7:26:7:29 | argv | a command-line argument |

cpp/ql/test/query-tests/Security/CWE/CWE-190/semmle/TaintedAllocationSize/TaintedAllocationSize.expected

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
edges
2-
| test.cpp:40:21:40:24 | argv | test.cpp:43:38:43:44 | tainted |
3-
| test.cpp:40:21:40:24 | argv | test.cpp:44:38:44:63 | ... * ... |
4-
| test.cpp:40:21:40:24 | argv | test.cpp:46:38:46:63 | ... + ... |
5-
| test.cpp:40:21:40:24 | argv | test.cpp:49:32:49:35 | size |
6-
| test.cpp:40:21:40:24 | argv | test.cpp:50:26:50:29 | size |
7-
| test.cpp:40:21:40:24 | argv | test.cpp:53:35:53:60 | ... * ... |
2+
| test.cpp:39:27:39:30 | argv | test.cpp:43:38:43:44 | tainted |
3+
| test.cpp:39:27:39:30 | argv | test.cpp:44:38:44:63 | ... * ... |
4+
| test.cpp:39:27:39:30 | argv | test.cpp:46:38:46:63 | ... + ... |
5+
| test.cpp:39:27:39:30 | argv | test.cpp:49:32:49:35 | size |
6+
| test.cpp:39:27:39:30 | argv | test.cpp:50:26:50:29 | size |
7+
| test.cpp:39:27:39:30 | argv | test.cpp:53:35:53:60 | ... * ... |
88
| test.cpp:124:18:124:23 | call to getenv | test.cpp:128:24:128:41 | ... * ... |
99
| test.cpp:133:19:133:24 | call to getenv | test.cpp:135:10:135:27 | ... * ... |
1010
| test.cpp:148:20:148:25 | call to getenv | test.cpp:152:11:152:28 | ... * ... |
@@ -26,7 +26,7 @@ edges
2626
| test.cpp:289:17:289:20 | size [post update] | test.cpp:291:11:291:28 | ... * ... |
2727
| test.cpp:305:18:305:21 | size [post update] | test.cpp:308:10:308:27 | ... * ... |
2828
nodes
29-
| test.cpp:40:21:40:24 | argv | semmle.label | argv |
29+
| test.cpp:39:27:39:30 | argv | semmle.label | argv |
3030
| test.cpp:43:38:43:44 | tainted | semmle.label | tainted |
3131
| test.cpp:44:38:44:63 | ... * ... | semmle.label | ... * ... |
3232
| test.cpp:46:38:46:63 | ... + ... | semmle.label | ... + ... |
@@ -60,12 +60,12 @@ nodes
6060
| test.cpp:308:10:308:27 | ... * ... | semmle.label | ... * ... |
6161
subpaths
6262
#select
63-
| test.cpp:43:31:43:36 | call to malloc | test.cpp:40:21:40:24 | argv | test.cpp:43:38:43:44 | tainted | This allocation size is derived from $@ and might overflow. | test.cpp:40:21:40:24 | argv | user input (a command-line argument) |
64-
| test.cpp:44:31:44:36 | call to malloc | test.cpp:40:21:40:24 | argv | test.cpp:44:38:44:63 | ... * ... | This allocation size is derived from $@ and might overflow. | test.cpp:40:21:40:24 | argv | user input (a command-line argument) |
65-
| test.cpp:46:31:46:36 | call to malloc | test.cpp:40:21:40:24 | argv | test.cpp:46:38:46:63 | ... + ... | This allocation size is derived from $@ and might overflow. | test.cpp:40:21:40:24 | argv | user input (a command-line argument) |
66-
| test.cpp:49:25:49:30 | call to malloc | test.cpp:40:21:40:24 | argv | test.cpp:49:32:49:35 | size | This allocation size is derived from $@ and might overflow. | test.cpp:40:21:40:24 | argv | user input (a command-line argument) |
67-
| test.cpp:50:17:50:30 | new[] | test.cpp:40:21:40:24 | argv | test.cpp:50:26:50:29 | size | This allocation size is derived from $@ and might overflow. | test.cpp:40:21:40:24 | argv | user input (a command-line argument) |
68-
| test.cpp:53:21:53:27 | call to realloc | test.cpp:40:21:40:24 | argv | test.cpp:53:35:53:60 | ... * ... | This allocation size is derived from $@ and might overflow. | test.cpp:40:21:40:24 | argv | user input (a command-line argument) |
63+
| test.cpp:43:31:43:36 | call to malloc | test.cpp:39:27:39:30 | argv | test.cpp:43:38:43:44 | tainted | This allocation size is derived from $@ and might overflow. | test.cpp:39:27:39:30 | argv | user input (a command-line argument) |
64+
| test.cpp:44:31:44:36 | call to malloc | test.cpp:39:27:39:30 | argv | test.cpp:44:38:44:63 | ... * ... | This allocation size is derived from $@ and might overflow. | test.cpp:39:27:39:30 | argv | user input (a command-line argument) |
65+
| test.cpp:46:31:46:36 | call to malloc | test.cpp:39:27:39:30 | argv | test.cpp:46:38:46:63 | ... + ... | This allocation size is derived from $@ and might overflow. | test.cpp:39:27:39:30 | argv | user input (a command-line argument) |
66+
| test.cpp:49:25:49:30 | call to malloc | test.cpp:39:27:39:30 | argv | test.cpp:49:32:49:35 | size | This allocation size is derived from $@ and might overflow. | test.cpp:39:27:39:30 | argv | user input (a command-line argument) |
67+
| test.cpp:50:17:50:30 | new[] | test.cpp:39:27:39:30 | argv | test.cpp:50:26:50:29 | size | This allocation size is derived from $@ and might overflow. | test.cpp:39:27:39:30 | argv | user input (a command-line argument) |
68+
| test.cpp:53:21:53:27 | call to realloc | test.cpp:39:27:39:30 | argv | test.cpp:53:35:53:60 | ... * ... | This allocation size is derived from $@ and might overflow. | test.cpp:39:27:39:30 | argv | user input (a command-line argument) |
6969
| test.cpp:128:17:128:22 | call to malloc | test.cpp:124:18:124:23 | call to getenv | test.cpp:128:24:128:41 | ... * ... | This allocation size is derived from $@ and might overflow. | test.cpp:124:18:124:23 | call to getenv | user input (an environment variable) |
7070
| test.cpp:135:3:135:8 | call to malloc | test.cpp:133:19:133:24 | call to getenv | test.cpp:135:10:135:27 | ... * ... | This allocation size is derived from $@ and might overflow. | test.cpp:133:19:133:24 | call to getenv | user input (an environment variable) |
7171
| test.cpp:152:4:152:9 | call to malloc | test.cpp:148:20:148:25 | call to getenv | test.cpp:152:11:152:28 | ... * ... | This allocation size is derived from $@ and might overflow. | test.cpp:148:20:148:25 | call to getenv | user input (an environment variable) |
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
edges
2-
| test.cpp:54:17:54:20 | argv | test.cpp:58:25:58:29 | input |
2+
| test.cpp:53:27:53:30 | argv | test.cpp:58:25:58:29 | input |
33
nodes
44
| test2.cpp:110:3:110:6 | call to gets | semmle.label | call to gets |
5-
| test.cpp:54:17:54:20 | argv | semmle.label | argv |
5+
| test.cpp:53:27:53:30 | argv | semmle.label | argv |
66
| test.cpp:58:25:58:29 | input | semmle.label | input |
77
subpaths
88
#select
99
| test2.cpp:110:3:110:6 | call to gets | test2.cpp:110:3:110:6 | call to gets | test2.cpp:110:3:110:6 | call to gets | This write into buffer 'password' may contain unencrypted data from $@. | test2.cpp:110:3:110:6 | call to gets | user input (string read by gets) |
10-
| test.cpp:58:3:58:9 | call to sprintf | test.cpp:54:17:54:20 | argv | test.cpp:58:25:58:29 | input | This write into buffer 'passwd' may contain unencrypted data from $@. | test.cpp:54:17:54:20 | argv | user input (a command-line argument) |
10+
| test.cpp:58:3:58:9 | call to sprintf | test.cpp:53:27:53:30 | argv | test.cpp:58:25:58:29 | input | This write into buffer 'passwd' may contain unencrypted data from $@. | test.cpp:53:27:53:30 | argv | user input (a command-line argument) |

0 commit comments

Comments
 (0)