Skip to content

Commit 30151c9

Browse files
committed
C++: Remove the std::string Constructor model.
1 parent d565cfc commit 30151c9

File tree

4 files changed

+0
-48
lines changed

4 files changed

+0
-48
lines changed

cpp/ql/src/semmle/code/cpp/models/implementations/StdString.qll

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,5 @@
11
import semmle.code.cpp.models.interfaces.Taint
22

3-
/**
4-
* The `std::basic_string` constructor(s).
5-
*/
6-
class StdStringConstructor extends TaintFunction {
7-
pragma[noinline]
8-
StdStringConstructor() { this.hasQualifiedName("std", "basic_string", "basic_string") }
9-
10-
override predicate hasTaintFlow(FunctionInput input, FunctionOutput output) {
11-
// flow from any constructor argument to return value
12-
input.isParameter(_) and
13-
output.isReturnValue()
14-
}
15-
}
16-
173
/**
184
* The standard function `std::string.c_str`.
195
*/

cpp/ql/test/library-tests/dataflow/taint-tests/localTaint.expected

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,8 @@
212212
| movableclass.cpp:59:21:59:33 | call to MyMovableClass | movableclass.cpp:63:8:63:9 | s2 | |
213213
| movableclass.cpp:60:18:60:19 | call to MyMovableClass | movableclass.cpp:64:8:64:9 | s3 | |
214214
| stl.cpp:67:12:67:17 | call to source | stl.cpp:71:7:71:7 | a | |
215-
| stl.cpp:68:16:68:20 | 123 | stl.cpp:68:16:68:21 | call to basic_string | TAINT |
216215
| stl.cpp:68:16:68:21 | call to basic_string | stl.cpp:72:7:72:7 | b | |
217216
| stl.cpp:68:16:68:21 | call to basic_string | stl.cpp:74:7:74:7 | b | |
218-
| stl.cpp:69:16:69:21 | call to source | stl.cpp:69:16:69:24 | call to basic_string | TAINT |
219217
| stl.cpp:69:16:69:24 | call to basic_string | stl.cpp:73:7:73:7 | c | |
220218
| stl.cpp:69:16:69:24 | call to basic_string | stl.cpp:75:7:75:7 | c | |
221219
| stl.cpp:74:7:74:7 | b | stl.cpp:74:9:74:13 | call to c_str | TAINT |
@@ -235,7 +233,6 @@
235233
| stl.cpp:80:40:80:42 | call to basic_stringstream | stl.cpp:87:2:87:4 | ss5 | |
236234
| stl.cpp:80:40:80:42 | call to basic_stringstream | stl.cpp:93:7:93:9 | ss5 | |
237235
| stl.cpp:80:40:80:42 | call to basic_stringstream | stl.cpp:98:7:98:9 | ss5 | |
238-
| stl.cpp:81:16:81:21 | call to source | stl.cpp:81:16:81:24 | call to basic_string | TAINT |
239236
| stl.cpp:81:16:81:24 | call to basic_string | stl.cpp:87:9:87:9 | t | |
240237
| stl.cpp:83:2:83:4 | ref arg ss1 | stl.cpp:89:7:89:9 | ss1 | |
241238
| stl.cpp:83:2:83:4 | ref arg ss1 | stl.cpp:94:7:94:9 | ss1 | |
@@ -259,27 +256,18 @@
259256
| stl.cpp:106:2:106:4 | ref arg ss2 | stl.cpp:109:7:109:9 | ss2 | |
260257
| stl.cpp:106:2:106:4 | ref arg ss2 | stl.cpp:111:7:111:9 | ss2 | |
261258
| stl.cpp:124:16:124:28 | call to basic_string | stl.cpp:125:7:125:11 | path1 | |
262-
| stl.cpp:124:17:124:26 | call to user_input | stl.cpp:124:16:124:28 | call to basic_string | TAINT |
263259
| stl.cpp:125:7:125:11 | path1 | stl.cpp:125:13:125:17 | call to c_str | TAINT |
264-
| stl.cpp:128:10:128:19 | call to user_input | stl.cpp:128:10:128:21 | call to basic_string | TAINT |
265260
| stl.cpp:128:10:128:21 | call to basic_string | stl.cpp:128:2:128:21 | ... = ... | |
266261
| stl.cpp:128:10:128:21 | call to basic_string | stl.cpp:129:7:129:11 | path2 | |
267262
| stl.cpp:129:7:129:11 | path2 | stl.cpp:129:13:129:17 | call to c_str | TAINT |
268-
| stl.cpp:131:15:131:24 | call to user_input | stl.cpp:131:15:131:27 | call to basic_string | TAINT |
269263
| stl.cpp:131:15:131:27 | call to basic_string | stl.cpp:132:7:132:11 | path3 | |
270264
| stl.cpp:132:7:132:11 | path3 | stl.cpp:132:13:132:17 | call to c_str | TAINT |
271-
| stl.cpp:138:18:138:24 | hello | stl.cpp:138:18:138:25 | call to basic_string | TAINT |
272265
| stl.cpp:138:18:138:25 | call to basic_string | stl.cpp:143:8:143:9 | s1 | |
273266
| stl.cpp:139:19:139:26 | call to basic_string | stl.cpp:144:8:144:9 | s2 | |
274-
| stl.cpp:139:20:139:26 | hello | stl.cpp:139:19:139:26 | call to basic_string | TAINT |
275267
| stl.cpp:141:8:141:14 | call to basic_string | stl.cpp:141:3:141:14 | ... = ... | |
276268
| stl.cpp:141:8:141:14 | call to basic_string | stl.cpp:145:8:145:9 | s3 | |
277-
| stl.cpp:141:8:141:14 | hello | stl.cpp:141:8:141:14 | call to basic_string | TAINT |
278-
| stl.cpp:149:18:149:23 | call to source | stl.cpp:149:18:149:26 | call to basic_string | TAINT |
279269
| stl.cpp:149:18:149:26 | call to basic_string | stl.cpp:154:8:154:9 | s1 | |
280270
| stl.cpp:150:19:150:27 | call to basic_string | stl.cpp:155:8:155:9 | s2 | |
281-
| stl.cpp:150:20:150:25 | call to source | stl.cpp:150:19:150:27 | call to basic_string | TAINT |
282-
| stl.cpp:152:8:152:13 | call to source | stl.cpp:152:8:152:15 | call to basic_string | TAINT |
283271
| stl.cpp:152:8:152:15 | call to basic_string | stl.cpp:152:3:152:15 | ... = ... | |
284272
| stl.cpp:152:8:152:15 | call to basic_string | stl.cpp:156:8:156:9 | s3 | |
285273
| stl.cpp:160:15:160:16 | call to basic_string | stl.cpp:161:20:161:21 | s1 | |
@@ -289,10 +277,8 @@
289277
| stl.cpp:163:8:163:9 | s1 | stl.cpp:163:3:163:9 | ... = ... | |
290278
| stl.cpp:163:8:163:9 | s1 | stl.cpp:167:8:167:9 | s3 | |
291279
| stl.cpp:171:19:171:40 | call to basic_string | stl.cpp:175:8:175:9 | s1 | |
292-
| stl.cpp:171:32:171:37 | call to source | stl.cpp:171:19:171:40 | call to basic_string | TAINT |
293280
| stl.cpp:173:8:173:28 | call to basic_string | stl.cpp:173:3:173:28 | ... = ... | |
294281
| stl.cpp:173:8:173:28 | call to basic_string | stl.cpp:176:8:176:9 | s2 | |
295-
| stl.cpp:173:20:173:25 | call to source | stl.cpp:173:8:173:28 | call to basic_string | TAINT |
296282
| structlikeclass.cpp:5:7:5:7 | Unknown literal | structlikeclass.cpp:5:7:5:7 | constructor init of field v | TAINT |
297283
| structlikeclass.cpp:5:7:5:7 | Unknown literal | structlikeclass.cpp:5:7:5:7 | constructor init of field v | TAINT |
298284
| structlikeclass.cpp:5:7:5:7 | this | structlikeclass.cpp:5:7:5:7 | constructor init of field v [pre-this] | |

cpp/ql/test/library-tests/dataflow/taint-tests/taint.expected

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,6 @@
1111
| format.cpp:157:7:157:22 | access to array | format.cpp:147:12:147:25 | call to source |
1212
| format.cpp:158:7:158:27 | ... + ... | format.cpp:148:16:148:30 | call to source |
1313
| stl.cpp:71:7:71:7 | a | stl.cpp:67:12:67:17 | call to source |
14-
| stl.cpp:73:7:73:7 | c | stl.cpp:69:16:69:21 | call to source |
15-
| stl.cpp:75:9:75:13 | call to c_str | stl.cpp:69:16:69:21 | call to source |
16-
| stl.cpp:125:13:125:17 | call to c_str | stl.cpp:117:10:117:15 | call to source |
17-
| stl.cpp:129:13:129:17 | call to c_str | stl.cpp:117:10:117:15 | call to source |
18-
| stl.cpp:132:13:132:17 | call to c_str | stl.cpp:117:10:117:15 | call to source |
19-
| stl.cpp:154:8:154:9 | s1 | stl.cpp:149:18:149:23 | call to source |
20-
| stl.cpp:155:8:155:9 | s2 | stl.cpp:150:20:150:25 | call to source |
21-
| stl.cpp:156:8:156:9 | s3 | stl.cpp:152:8:152:13 | call to source |
22-
| stl.cpp:175:8:175:9 | s1 | stl.cpp:171:32:171:37 | call to source |
23-
| stl.cpp:176:8:176:9 | s2 | stl.cpp:173:20:173:25 | call to source |
2414
| swap1.cpp:60:12:60:16 | data1 | swap1.cpp:58:15:58:20 | call to source |
2515
| swap1.cpp:65:12:65:16 | data1 | swap1.cpp:58:15:58:20 | call to source |
2616
| swap1.cpp:66:12:66:16 | data1 | swap1.cpp:58:15:58:20 | call to source |

cpp/ql/test/library-tests/dataflow/taint-tests/test_diff.expected

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,6 @@
88
| format.cpp:100:8:100:13 | format.cpp:99:30:99:43 | AST only |
99
| format.cpp:105:8:105:13 | format.cpp:104:31:104:45 | AST only |
1010
| format.cpp:110:8:110:14 | format.cpp:109:38:109:52 | AST only |
11-
| stl.cpp:73:7:73:7 | stl.cpp:69:16:69:21 | AST only |
12-
| stl.cpp:75:9:75:13 | stl.cpp:69:16:69:21 | AST only |
13-
| stl.cpp:125:13:125:17 | stl.cpp:117:10:117:15 | AST only |
14-
| stl.cpp:129:13:129:17 | stl.cpp:117:10:117:15 | AST only |
15-
| stl.cpp:132:13:132:17 | stl.cpp:117:10:117:15 | AST only |
16-
| stl.cpp:154:8:154:9 | stl.cpp:149:18:149:23 | AST only |
17-
| stl.cpp:155:8:155:9 | stl.cpp:150:20:150:25 | AST only |
18-
| stl.cpp:156:8:156:9 | stl.cpp:152:8:152:13 | AST only |
19-
| stl.cpp:175:8:175:9 | stl.cpp:171:32:171:37 | AST only |
20-
| stl.cpp:176:8:176:9 | stl.cpp:173:20:173:25 | AST only |
2111
| swap1.cpp:74:13:74:17 | swap1.cpp:69:16:69:21 | AST only |
2212
| swap1.cpp:75:13:75:17 | swap1.cpp:68:27:68:28 | AST only |
2313
| swap1.cpp:89:12:89:16 | swap1.cpp:80:23:80:23 | AST only |

0 commit comments

Comments
 (0)