Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 00a25db

Browse files
committed
C++: Accept test changes.
1 parent 01a81a9 commit 00a25db

3 files changed

Lines changed: 70 additions & 0 deletions

File tree

Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
edges
2+
| CWE122_Heap_Based_Buffer_Overflow__c_CWE129_fgets_01.c:30:19:30:29 | fgets output argument | CWE122_Heap_Based_Buffer_Overflow__c_CWE129_fgets_01.c:52:20:52:23 | data |
23
nodes
4+
| CWE122_Heap_Based_Buffer_Overflow__c_CWE129_fgets_01.c:30:19:30:29 | fgets output argument | semmle.label | fgets output argument |
5+
| CWE122_Heap_Based_Buffer_Overflow__c_CWE129_fgets_01.c:52:20:52:23 | data | semmle.label | data |
36
subpaths
47
#select
8+
| CWE122_Heap_Based_Buffer_Overflow__c_CWE129_fgets_01.c:52:20:52:23 | data | CWE122_Heap_Based_Buffer_Overflow__c_CWE129_fgets_01.c:30:19:30:29 | fgets output argument | CWE122_Heap_Based_Buffer_Overflow__c_CWE129_fgets_01.c:52:20:52:23 | data | An array indexing expression depends on $@ that might be outside the bounds of the array. | CWE122_Heap_Based_Buffer_Overflow__c_CWE129_fgets_01.c:30:19:30:29 | fgets output argument | string read by fgets |

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

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,57 @@ edges
55
| test.cpp:40:21:40:24 | argv | test.cpp:49:32:49:35 | size |
66
| test.cpp:40:21:40:24 | argv | test.cpp:50:26:50:29 | size |
77
| test.cpp:40:21:40:24 | argv | test.cpp:53:35:53:60 | ... * ... |
8+
| test.cpp:76:25:76:29 | start | test.cpp:80:18:80:28 | ... - ... |
9+
| test.cpp:76:25:76:29 | start indirection | test.cpp:80:18:80:28 | ... - ... |
10+
| test.cpp:76:38:76:40 | end | test.cpp:80:18:80:28 | ... - ... |
11+
| test.cpp:76:38:76:40 | end indirection | test.cpp:80:18:80:28 | ... - ... |
12+
| test.cpp:98:18:98:23 | fread output argument | test.cpp:102:17:102:22 | buffer |
13+
| test.cpp:98:18:98:23 | fread output argument | test.cpp:102:17:102:22 | buffer indirection |
14+
| test.cpp:98:18:98:23 | fread output argument | test.cpp:102:25:102:39 | ... + ... |
15+
| test.cpp:98:18:98:23 | fread output argument | test.cpp:102:25:102:39 | ... + ... indirection |
16+
| test.cpp:102:17:102:22 | buffer | test.cpp:76:25:76:29 | start |
17+
| test.cpp:102:17:102:22 | buffer indirection | test.cpp:76:25:76:29 | start indirection |
18+
| test.cpp:102:25:102:39 | ... + ... | test.cpp:76:38:76:40 | end |
19+
| test.cpp:102:25:102:39 | ... + ... indirection | test.cpp:76:38:76:40 | end indirection |
820
| test.cpp:124:18:124:23 | call to getenv | test.cpp:125:29:125:32 | size |
921
| test.cpp:124:18:124:23 | call to getenv | test.cpp:128:24:128:41 | ... * ... |
22+
| test.cpp:124:18:124:31 | call to getenv indirection | test.cpp:125:29:125:32 | size |
23+
| test.cpp:124:18:124:31 | call to getenv indirection | test.cpp:128:24:128:41 | ... * ... |
1024
| test.cpp:125:29:125:32 | size | test.cpp:127:24:127:49 | ... * ... |
1125
| test.cpp:133:19:133:24 | call to getenv | test.cpp:135:10:135:27 | ... * ... |
26+
| test.cpp:133:19:133:32 | call to getenv indirection | test.cpp:135:10:135:27 | ... * ... |
1227
| test.cpp:148:20:148:25 | call to getenv | test.cpp:152:11:152:28 | ... * ... |
28+
| test.cpp:148:20:148:33 | call to getenv indirection | test.cpp:152:11:152:28 | ... * ... |
1329
| test.cpp:157:19:157:24 | call to getenv | test.cpp:161:11:161:28 | ... * ... |
30+
| test.cpp:157:19:157:32 | call to getenv indirection | test.cpp:161:11:161:28 | ... * ... |
1431
| test.cpp:184:19:184:24 | call to getenv | test.cpp:186:10:186:27 | ... * ... |
32+
| test.cpp:184:19:184:32 | call to getenv indirection | test.cpp:186:10:186:27 | ... * ... |
1533
| test.cpp:209:8:209:23 | VariableAddress indirection | test.cpp:241:9:241:24 | call to get_tainted_size |
1634
| test.cpp:211:14:211:19 | call to getenv | test.cpp:209:8:209:23 | VariableAddress indirection |
35+
| test.cpp:211:14:211:27 | call to getenv indirection | test.cpp:209:8:209:23 | VariableAddress indirection |
1736
| test.cpp:214:8:214:23 | VariableAddress indirection | test.cpp:242:9:242:24 | call to get_bounded_size |
1837
| test.cpp:216:18:216:23 | call to getenv | test.cpp:214:8:214:23 | VariableAddress indirection |
38+
| test.cpp:216:18:216:31 | call to getenv indirection | test.cpp:214:8:214:23 | VariableAddress indirection |
1939
| test.cpp:224:23:224:23 | s | test.cpp:225:21:225:21 | s |
2040
| test.cpp:230:21:230:21 | s | test.cpp:231:21:231:21 | s |
2141
| test.cpp:237:24:237:29 | call to getenv | test.cpp:239:9:239:18 | local_size |
2242
| test.cpp:237:24:237:29 | call to getenv | test.cpp:245:11:245:20 | local_size |
2343
| test.cpp:237:24:237:29 | call to getenv | test.cpp:247:10:247:19 | local_size |
44+
| test.cpp:237:24:237:37 | call to getenv indirection | test.cpp:239:9:239:18 | local_size |
45+
| test.cpp:237:24:237:37 | call to getenv indirection | test.cpp:245:11:245:20 | local_size |
46+
| test.cpp:237:24:237:37 | call to getenv indirection | test.cpp:247:10:247:19 | local_size |
2447
| test.cpp:245:11:245:20 | local_size | test.cpp:224:23:224:23 | s |
2548
| test.cpp:247:10:247:19 | local_size | test.cpp:230:21:230:21 | s |
2649
| test.cpp:250:20:250:27 | Load indirection | test.cpp:289:17:289:20 | get_size output argument |
2750
| test.cpp:250:20:250:27 | Load indirection | test.cpp:305:18:305:21 | get_size output argument |
2851
| test.cpp:251:18:251:23 | call to getenv | test.cpp:250:20:250:27 | Load indirection |
52+
| test.cpp:251:18:251:31 | call to getenv indirection | test.cpp:250:20:250:27 | Load indirection |
2953
| test.cpp:259:20:259:25 | call to getenv | test.cpp:263:11:263:29 | ... * ... |
54+
| test.cpp:259:20:259:33 | call to getenv indirection | test.cpp:263:11:263:29 | ... * ... |
3055
| test.cpp:289:17:289:20 | get_size output argument | test.cpp:291:11:291:28 | ... * ... |
3156
| test.cpp:305:18:305:21 | get_size output argument | test.cpp:308:10:308:27 | ... * ... |
3257
| test.cpp:331:15:331:20 | Call | test.cpp:334:9:334:14 | offset |
58+
| test.cpp:331:15:331:20 | Call indirection | test.cpp:334:9:334:14 | offset |
3359
nodes
3460
| test.cpp:40:21:40:24 | argv | semmle.label | argv |
3561
| test.cpp:43:38:43:44 | tainted | semmle.label | tainted |
@@ -38,41 +64,62 @@ nodes
3864
| test.cpp:49:32:49:35 | size | semmle.label | size |
3965
| test.cpp:50:26:50:29 | size | semmle.label | size |
4066
| test.cpp:53:35:53:60 | ... * ... | semmle.label | ... * ... |
67+
| test.cpp:76:25:76:29 | start | semmle.label | start |
68+
| test.cpp:76:25:76:29 | start indirection | semmle.label | start indirection |
69+
| test.cpp:76:38:76:40 | end | semmle.label | end |
70+
| test.cpp:76:38:76:40 | end indirection | semmle.label | end indirection |
71+
| test.cpp:80:18:80:28 | ... - ... | semmle.label | ... - ... |
72+
| test.cpp:98:18:98:23 | fread output argument | semmle.label | fread output argument |
73+
| test.cpp:102:17:102:22 | buffer | semmle.label | buffer |
74+
| test.cpp:102:17:102:22 | buffer indirection | semmle.label | buffer indirection |
75+
| test.cpp:102:25:102:39 | ... + ... | semmle.label | ... + ... |
76+
| test.cpp:102:25:102:39 | ... + ... indirection | semmle.label | ... + ... indirection |
4177
| test.cpp:124:18:124:23 | call to getenv | semmle.label | call to getenv |
78+
| test.cpp:124:18:124:31 | call to getenv indirection | semmle.label | call to getenv indirection |
4279
| test.cpp:125:29:125:32 | size | semmle.label | size |
4380
| test.cpp:127:24:127:49 | ... * ... | semmle.label | ... * ... |
4481
| test.cpp:128:24:128:41 | ... * ... | semmle.label | ... * ... |
4582
| test.cpp:133:19:133:24 | call to getenv | semmle.label | call to getenv |
83+
| test.cpp:133:19:133:32 | call to getenv indirection | semmle.label | call to getenv indirection |
4684
| test.cpp:135:10:135:27 | ... * ... | semmle.label | ... * ... |
4785
| test.cpp:148:20:148:25 | call to getenv | semmle.label | call to getenv |
86+
| test.cpp:148:20:148:33 | call to getenv indirection | semmle.label | call to getenv indirection |
4887
| test.cpp:152:11:152:28 | ... * ... | semmle.label | ... * ... |
4988
| test.cpp:157:19:157:24 | call to getenv | semmle.label | call to getenv |
89+
| test.cpp:157:19:157:32 | call to getenv indirection | semmle.label | call to getenv indirection |
5090
| test.cpp:161:11:161:28 | ... * ... | semmle.label | ... * ... |
5191
| test.cpp:184:19:184:24 | call to getenv | semmle.label | call to getenv |
92+
| test.cpp:184:19:184:32 | call to getenv indirection | semmle.label | call to getenv indirection |
5293
| test.cpp:186:10:186:27 | ... * ... | semmle.label | ... * ... |
5394
| test.cpp:209:8:209:23 | VariableAddress indirection | semmle.label | VariableAddress indirection |
5495
| test.cpp:211:14:211:19 | call to getenv | semmle.label | call to getenv |
96+
| test.cpp:211:14:211:27 | call to getenv indirection | semmle.label | call to getenv indirection |
5597
| test.cpp:214:8:214:23 | VariableAddress indirection | semmle.label | VariableAddress indirection |
5698
| test.cpp:216:18:216:23 | call to getenv | semmle.label | call to getenv |
99+
| test.cpp:216:18:216:31 | call to getenv indirection | semmle.label | call to getenv indirection |
57100
| test.cpp:224:23:224:23 | s | semmle.label | s |
58101
| test.cpp:225:21:225:21 | s | semmle.label | s |
59102
| test.cpp:230:21:230:21 | s | semmle.label | s |
60103
| test.cpp:231:21:231:21 | s | semmle.label | s |
61104
| test.cpp:237:24:237:29 | call to getenv | semmle.label | call to getenv |
105+
| test.cpp:237:24:237:37 | call to getenv indirection | semmle.label | call to getenv indirection |
62106
| test.cpp:239:9:239:18 | local_size | semmle.label | local_size |
63107
| test.cpp:241:9:241:24 | call to get_tainted_size | semmle.label | call to get_tainted_size |
64108
| test.cpp:242:9:242:24 | call to get_bounded_size | semmle.label | call to get_bounded_size |
65109
| test.cpp:245:11:245:20 | local_size | semmle.label | local_size |
66110
| test.cpp:247:10:247:19 | local_size | semmle.label | local_size |
67111
| test.cpp:250:20:250:27 | Load indirection | semmle.label | Load indirection |
68112
| test.cpp:251:18:251:23 | call to getenv | semmle.label | call to getenv |
113+
| test.cpp:251:18:251:31 | call to getenv indirection | semmle.label | call to getenv indirection |
69114
| test.cpp:259:20:259:25 | call to getenv | semmle.label | call to getenv |
115+
| test.cpp:259:20:259:33 | call to getenv indirection | semmle.label | call to getenv indirection |
70116
| test.cpp:263:11:263:29 | ... * ... | semmle.label | ... * ... |
71117
| test.cpp:289:17:289:20 | get_size output argument | semmle.label | get_size output argument |
72118
| test.cpp:291:11:291:28 | ... * ... | semmle.label | ... * ... |
73119
| test.cpp:305:18:305:21 | get_size output argument | semmle.label | get_size output argument |
74120
| test.cpp:308:10:308:27 | ... * ... | semmle.label | ... * ... |
75121
| test.cpp:331:15:331:20 | Call | semmle.label | Call |
122+
| test.cpp:331:15:331:20 | Call indirection | semmle.label | Call indirection |
76123
| test.cpp:334:9:334:14 | offset | semmle.label | offset |
77124
subpaths
78125
#select
@@ -82,18 +129,34 @@ subpaths
82129
| 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) |
83130
| 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) |
84131
| 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) |
132+
| test.cpp:80:9:80:29 | new[] | test.cpp:98:18:98:23 | fread output argument | test.cpp:80:18:80:28 | ... - ... | This allocation size is derived from $@ and might overflow. | test.cpp:98:18:98:23 | fread output argument | user input (String read by fread) |
85133
| test.cpp:127:17:127:22 | call to malloc | test.cpp:124:18:124:23 | call to getenv | test.cpp:127:24:127:49 | ... * ... | This allocation size is derived from $@ and might overflow. | test.cpp:124:18:124:23 | call to getenv | user input (an environment variable) |
134+
| test.cpp:127:17:127:22 | call to malloc | test.cpp:124:18:124:31 | call to getenv indirection | test.cpp:127:24:127:49 | ... * ... | This allocation size is derived from $@ and might overflow. | test.cpp:124:18:124:31 | call to getenv indirection | user input (an environment variable) |
86135
| 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) |
136+
| test.cpp:128:17:128:22 | call to malloc | test.cpp:124:18:124:31 | call to getenv indirection | test.cpp:128:24:128:41 | ... * ... | This allocation size is derived from $@ and might overflow. | test.cpp:124:18:124:31 | call to getenv indirection | user input (an environment variable) |
87137
| 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) |
138+
| test.cpp:135:3:135:8 | call to malloc | test.cpp:133:19:133:32 | call to getenv indirection | test.cpp:135:10:135:27 | ... * ... | This allocation size is derived from $@ and might overflow. | test.cpp:133:19:133:32 | call to getenv indirection | user input (an environment variable) |
88139
| 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) |
140+
| test.cpp:152:4:152:9 | call to malloc | test.cpp:148:20:148:33 | call to getenv indirection | test.cpp:152:11:152:28 | ... * ... | This allocation size is derived from $@ and might overflow. | test.cpp:148:20:148:33 | call to getenv indirection | user input (an environment variable) |
89141
| test.cpp:161:4:161:9 | call to malloc | test.cpp:157:19:157:24 | call to getenv | test.cpp:161:11:161:28 | ... * ... | This allocation size is derived from $@ and might overflow. | test.cpp:157:19:157:24 | call to getenv | user input (an environment variable) |
142+
| test.cpp:161:4:161:9 | call to malloc | test.cpp:157:19:157:32 | call to getenv indirection | test.cpp:161:11:161:28 | ... * ... | This allocation size is derived from $@ and might overflow. | test.cpp:157:19:157:32 | call to getenv indirection | user input (an environment variable) |
90143
| test.cpp:186:3:186:8 | call to malloc | test.cpp:184:19:184:24 | call to getenv | test.cpp:186:10:186:27 | ... * ... | This allocation size is derived from $@ and might overflow. | test.cpp:184:19:184:24 | call to getenv | user input (an environment variable) |
144+
| test.cpp:186:3:186:8 | call to malloc | test.cpp:184:19:184:32 | call to getenv indirection | test.cpp:186:10:186:27 | ... * ... | This allocation size is derived from $@ and might overflow. | test.cpp:184:19:184:32 | call to getenv indirection | user input (an environment variable) |
91145
| test.cpp:225:14:225:19 | call to malloc | test.cpp:237:24:237:29 | call to getenv | test.cpp:225:21:225:21 | s | This allocation size is derived from $@ and might overflow. | test.cpp:237:24:237:29 | call to getenv | user input (an environment variable) |
146+
| test.cpp:225:14:225:19 | call to malloc | test.cpp:237:24:237:37 | call to getenv indirection | test.cpp:225:21:225:21 | s | This allocation size is derived from $@ and might overflow. | test.cpp:237:24:237:37 | call to getenv indirection | user input (an environment variable) |
92147
| test.cpp:231:14:231:19 | call to malloc | test.cpp:237:24:237:29 | call to getenv | test.cpp:231:21:231:21 | s | This allocation size is derived from $@ and might overflow. | test.cpp:237:24:237:29 | call to getenv | user input (an environment variable) |
148+
| test.cpp:231:14:231:19 | call to malloc | test.cpp:237:24:237:37 | call to getenv indirection | test.cpp:231:21:231:21 | s | This allocation size is derived from $@ and might overflow. | test.cpp:237:24:237:37 | call to getenv indirection | user input (an environment variable) |
93149
| test.cpp:239:2:239:7 | call to malloc | test.cpp:237:24:237:29 | call to getenv | test.cpp:239:9:239:18 | local_size | This allocation size is derived from $@ and might overflow. | test.cpp:237:24:237:29 | call to getenv | user input (an environment variable) |
150+
| test.cpp:239:2:239:7 | call to malloc | test.cpp:237:24:237:37 | call to getenv indirection | test.cpp:239:9:239:18 | local_size | This allocation size is derived from $@ and might overflow. | test.cpp:237:24:237:37 | call to getenv indirection | user input (an environment variable) |
94151
| test.cpp:241:2:241:7 | call to malloc | test.cpp:211:14:211:19 | call to getenv | test.cpp:241:9:241:24 | call to get_tainted_size | This allocation size is derived from $@ and might overflow. | test.cpp:211:14:211:19 | call to getenv | user input (an environment variable) |
152+
| test.cpp:241:2:241:7 | call to malloc | test.cpp:211:14:211:27 | call to getenv indirection | test.cpp:241:9:241:24 | call to get_tainted_size | This allocation size is derived from $@ and might overflow. | test.cpp:211:14:211:27 | call to getenv indirection | user input (an environment variable) |
95153
| test.cpp:242:2:242:7 | call to malloc | test.cpp:216:18:216:23 | call to getenv | test.cpp:242:9:242:24 | call to get_bounded_size | This allocation size is derived from $@ and might overflow. | test.cpp:216:18:216:23 | call to getenv | user input (an environment variable) |
154+
| test.cpp:242:2:242:7 | call to malloc | test.cpp:216:18:216:31 | call to getenv indirection | test.cpp:242:9:242:24 | call to get_bounded_size | This allocation size is derived from $@ and might overflow. | test.cpp:216:18:216:31 | call to getenv indirection | user input (an environment variable) |
96155
| test.cpp:263:4:263:9 | call to malloc | test.cpp:259:20:259:25 | call to getenv | test.cpp:263:11:263:29 | ... * ... | This allocation size is derived from $@ and might overflow. | test.cpp:259:20:259:25 | call to getenv | user input (an environment variable) |
156+
| test.cpp:263:4:263:9 | call to malloc | test.cpp:259:20:259:33 | call to getenv indirection | test.cpp:263:11:263:29 | ... * ... | This allocation size is derived from $@ and might overflow. | test.cpp:259:20:259:33 | call to getenv indirection | user input (an environment variable) |
97157
| test.cpp:291:4:291:9 | call to malloc | test.cpp:251:18:251:23 | call to getenv | test.cpp:291:11:291:28 | ... * ... | This allocation size is derived from $@ and might overflow. | test.cpp:251:18:251:23 | call to getenv | user input (an environment variable) |
158+
| test.cpp:291:4:291:9 | call to malloc | test.cpp:251:18:251:31 | call to getenv indirection | test.cpp:291:11:291:28 | ... * ... | This allocation size is derived from $@ and might overflow. | test.cpp:251:18:251:31 | call to getenv indirection | user input (an environment variable) |
98159
| test.cpp:308:3:308:8 | call to malloc | test.cpp:251:18:251:23 | call to getenv | test.cpp:308:10:308:27 | ... * ... | This allocation size is derived from $@ and might overflow. | test.cpp:251:18:251:23 | call to getenv | user input (an environment variable) |
160+
| test.cpp:308:3:308:8 | call to malloc | test.cpp:251:18:251:31 | call to getenv indirection | test.cpp:308:10:308:27 | ... * ... | This allocation size is derived from $@ and might overflow. | test.cpp:251:18:251:31 | call to getenv indirection | user input (an environment variable) |
99161
| test.cpp:334:2:334:7 | call to malloc | test.cpp:331:15:331:20 | Call | test.cpp:334:9:334:14 | offset | This allocation size is derived from $@ and might overflow. | test.cpp:331:15:331:20 | Call | user input (an environment variable) |
162+
| test.cpp:334:2:334:7 | call to malloc | test.cpp:331:15:331:20 | Call indirection | test.cpp:334:9:334:14 | offset | This allocation size is derived from $@ and might overflow. | test.cpp:331:15:331:20 | Call indirection | user input (an environment variable) |

0 commit comments

Comments
 (0)