Skip to content

Commit e95aefe

Browse files
committed
C++: Now that PrimaryArgumentNode is an OperandNode we want a specialized toString on it
1 parent d162c3d commit e95aefe

File tree

6 files changed

+17
-11
lines changed

6 files changed

+17
-11
lines changed

cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowPrivate.qll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ private class PrimaryArgumentNode extends ArgumentNode {
3333
or
3434
op = call.getThisArgumentOperand() and pos = -1
3535
}
36+
37+
override string toString() {
38+
result = "Argument " + op.(PositionalArgumentOperand).getIndex()
39+
or
40+
op instanceof ThisArgumentOperand and result = "this"
41+
}
3642
}
3743

3844
/**

cpp/ql/test/query-tests/Security/CWE/CWE-079/semmle/CgiXss/CgiXss.expected

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ nodes
2121
| search.c:23:39:23:43 | query | semmle.label | query |
2222
| search.c:41:21:41:26 | call to getenv | semmle.label | call to getenv |
2323
| search.c:41:21:41:26 | call to getenv | semmle.label | call to getenv |
24-
| search.c:45:5:45:15 | Arg(0) | semmle.label | Arg(0) |
25-
| search.c:47:5:47:15 | Arg(0) | semmle.label | Arg(0) |
24+
| search.c:45:5:45:15 | Argument 0 | semmle.label | Argument 0 |
25+
| search.c:47:5:47:15 | Argument 0 | semmle.label | Argument 0 |
2626
#select
2727
| search.c:17:8:17:12 | query | search.c:41:21:41:26 | call to getenv | search.c:17:8:17:12 | query | Cross-site scripting vulnerability due to $@. | search.c:41:21:41:26 | call to getenv | this query data |
2828
| search.c:23:39:23:43 | query | search.c:41:21:41:26 | call to getenv | search.c:23:39:23:43 | query | Cross-site scripting vulnerability due to $@. | search.c:41:21:41:26 | call to getenv | this query data |

cpp/ql/test/query-tests/Security/CWE/CWE-114/semmle/UncontrolledProcessOperation/UncontrolledProcessOperation.expected

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ nodes
3232
| test.cpp:31:10:31:16 | command | semmle.label | command |
3333
| test.cpp:31:10:31:16 | command | semmle.label | command |
3434
| test.cpp:31:10:31:16 | command | semmle.label | command |
35-
| test.cpp:42:7:42:16 | Arg(0) | semmle.label | Arg(0) |
35+
| test.cpp:42:7:42:16 | Argument 0 | semmle.label | Argument 0 |
3636
| test.cpp:42:18:42:23 | call to getenv | semmle.label | call to getenv |
3737
| test.cpp:42:18:42:34 | (const char *)... | semmle.label | (const char *)... |
38-
| test.cpp:43:7:43:16 | Arg(0) | semmle.label | Arg(0) |
38+
| test.cpp:43:7:43:16 | Argument 0 | semmle.label | Argument 0 |
3939
| test.cpp:43:18:43:23 | call to getenv | semmle.label | call to getenv |
4040
| test.cpp:43:18:43:34 | (const char *)... | semmle.label | (const char *)... |
4141
| test.cpp:56:12:56:17 | buffer | semmle.label | buffer |

cpp/ql/test/query-tests/Security/CWE/CWE-134/semmle/argv/argvLocal.expected

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ nodes
214214
| argvLocal.c:116:9:116:10 | (const char *)... | semmle.label | (const char *)... |
215215
| argvLocal.c:116:9:116:10 | (const char *)... | semmle.label | (const char *)... |
216216
| argvLocal.c:116:9:116:10 | i3 | semmle.label | i3 |
217-
| argvLocal.c:117:2:117:13 | Arg(0) | semmle.label | Arg(0) |
217+
| argvLocal.c:117:2:117:13 | Argument 0 | semmle.label | Argument 0 |
218218
| argvLocal.c:117:15:117:16 | Argument 0 indirection | semmle.label | Argument 0 indirection |
219219
| argvLocal.c:117:15:117:16 | array to pointer conversion | semmle.label | array to pointer conversion |
220220
| argvLocal.c:117:15:117:16 | array to pointer conversion | semmle.label | array to pointer conversion |
@@ -223,7 +223,7 @@ nodes
223223
| argvLocal.c:121:9:121:10 | (const char *)... | semmle.label | (const char *)... |
224224
| argvLocal.c:121:9:121:10 | (const char *)... | semmle.label | (const char *)... |
225225
| argvLocal.c:121:9:121:10 | i4 | semmle.label | i4 |
226-
| argvLocal.c:122:2:122:13 | Arg(0) | semmle.label | Arg(0) |
226+
| argvLocal.c:122:2:122:13 | Argument 0 | semmle.label | Argument 0 |
227227
| argvLocal.c:122:15:122:16 | Argument 0 indirection | semmle.label | Argument 0 indirection |
228228
| argvLocal.c:122:15:122:16 | i4 | semmle.label | i4 |
229229
| argvLocal.c:122:15:122:16 | i4 | semmle.label | i4 |
@@ -234,7 +234,7 @@ nodes
234234
| argvLocal.c:127:9:127:10 | (const char *)... | semmle.label | (const char *)... |
235235
| argvLocal.c:127:9:127:10 | (const char *)... | semmle.label | (const char *)... |
236236
| argvLocal.c:127:9:127:10 | i5 | semmle.label | i5 |
237-
| argvLocal.c:128:2:128:13 | Arg(0) | semmle.label | Arg(0) |
237+
| argvLocal.c:128:2:128:13 | Argument 0 | semmle.label | Argument 0 |
238238
| argvLocal.c:128:15:128:16 | Argument 0 indirection | semmle.label | Argument 0 indirection |
239239
| argvLocal.c:128:15:128:16 | array to pointer conversion | semmle.label | array to pointer conversion |
240240
| argvLocal.c:128:15:128:16 | array to pointer conversion | semmle.label | array to pointer conversion |

cpp/ql/test/query-tests/Security/CWE/CWE-134/semmle/globalVars/UncontrolledFormatStringThroughGlobalVar.expected

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ nodes
3636
| globalVars.c:12:2:12:15 | Store | semmle.label | Store |
3737
| globalVars.c:15:21:15:23 | val | semmle.label | val |
3838
| globalVars.c:16:2:16:12 | Store | semmle.label | Store |
39-
| globalVars.c:24:2:24:9 | Arg(0) | semmle.label | Arg(0) |
39+
| globalVars.c:24:2:24:9 | Argument 0 | semmle.label | Argument 0 |
4040
| globalVars.c:24:11:24:14 | argv | semmle.label | argv |
4141
| globalVars.c:24:11:24:14 | argv | semmle.label | argv |
4242
| globalVars.c:27:9:27:12 | (const char *)... | semmle.label | (const char *)... |
@@ -47,7 +47,7 @@ nodes
4747
| globalVars.c:30:15:30:18 | copy | semmle.label | copy |
4848
| globalVars.c:30:15:30:18 | copy | semmle.label | copy |
4949
| globalVars.c:30:15:30:18 | copy | semmle.label | copy |
50-
| globalVars.c:35:2:35:9 | Arg(0) | semmle.label | Arg(0) |
50+
| globalVars.c:35:2:35:9 | Argument 0 | semmle.label | Argument 0 |
5151
| globalVars.c:35:11:35:14 | copy | semmle.label | copy |
5252
| globalVars.c:38:9:38:13 | (const char *)... | semmle.label | (const char *)... |
5353
| globalVars.c:38:9:38:13 | (const char *)... | semmle.label | (const char *)... |

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ nodes
141141
| test.cpp:231:9:231:24 | call to get_tainted_size | semmle.label | call to get_tainted_size |
142142
| test.cpp:231:9:231:24 | call to get_tainted_size | semmle.label | call to get_tainted_size |
143143
| test.cpp:231:9:231:24 | call to get_tainted_size | semmle.label | call to get_tainted_size |
144-
| test.cpp:235:2:235:9 | Arg(0) | semmle.label | Arg(0) |
145-
| test.cpp:237:2:237:8 | Arg(0) | semmle.label | Arg(0) |
144+
| test.cpp:235:2:235:9 | Argument 0 | semmle.label | Argument 0 |
145+
| test.cpp:237:2:237:8 | Argument 0 | semmle.label | Argument 0 |
146146
| test.cpp:241:2:241:32 | Chi [array content] | semmle.label | Chi [array content] |
147147
| test.cpp:241:2:241:32 | Store | semmle.label | Store |
148148
| test.cpp:241:18:241:23 | call to getenv | semmle.label | call to getenv |

0 commit comments

Comments
 (0)