Skip to content

Commit 0acef59

Browse files
committed
C++: Add more MaD models.
1 parent 64464b3 commit 0acef59

File tree

5 files changed

+23
-8
lines changed

5 files changed

+23
-8
lines changed

cpp/ql/lib/ext/CStrBufT.model.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
extensions:
2+
- addsTo:
3+
pack: codeql/cpp-all
4+
extensible: summaryModel
5+
data:
6+
- ["", "CStrBufT", True, "CStrBufT", "", "", "Argument[*0]", "Argument[-1]", "value", "manual"]
7+
- ["", "CStrBufT", True, "operator PCXSTR", "", "", "Argument[-1]", "ReturnValue[*]", "value", "manual"]
8+
- ["", "CStrBufT", True, "operator PXSTR", "", "", "Argument[-1]", "ReturnValue[*]", "value", "manual"]

cpp/ql/lib/ext/CStringData.model.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
extensions:
2+
- addsTo:
3+
pack: codeql/cpp-all
4+
extensible: summaryModel
5+
data:
6+
- ["", "CStringData", True, "data", "", "", "Argument[-1]", "ReturnValue[*]", "value", "manual"]

cpp/ql/test/library-tests/dataflow/external-models/flow.expected

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ edges
1010
| asio_streams.cpp:100:44:100:62 | call to buffer | asio_streams.cpp:103:29:103:39 | *send_buffer | provenance | Sink:MaD:6 |
1111
| asio_streams.cpp:100:64:100:71 | *send_str | asio_streams.cpp:56:18:56:23 | [summary param] *0 in buffer | provenance | |
1212
| asio_streams.cpp:100:64:100:71 | *send_str | asio_streams.cpp:100:44:100:62 | call to buffer | provenance | MaD:10 |
13-
| test.cpp:4:5:4:11 | [summary param] 0 in ymlStep | test.cpp:4:5:4:11 | [summary] to write: ReturnValue in ymlStep | provenance | MaD:950 |
14-
| test.cpp:7:10:7:18 | call to ymlSource | test.cpp:7:10:7:18 | call to ymlSource | provenance | Src:MaD:948 |
15-
| test.cpp:7:10:7:18 | call to ymlSource | test.cpp:11:10:11:10 | x | provenance | Sink:MaD:949 |
13+
| test.cpp:4:5:4:11 | [summary param] 0 in ymlStep | test.cpp:4:5:4:11 | [summary] to write: ReturnValue in ymlStep | provenance | MaD:954 |
14+
| test.cpp:7:10:7:18 | call to ymlSource | test.cpp:7:10:7:18 | call to ymlSource | provenance | Src:MaD:952 |
15+
| test.cpp:7:10:7:18 | call to ymlSource | test.cpp:11:10:11:10 | x | provenance | Sink:MaD:953 |
1616
| test.cpp:7:10:7:18 | call to ymlSource | test.cpp:13:18:13:18 | x | provenance | |
1717
| test.cpp:13:10:13:16 | call to ymlStep | test.cpp:13:10:13:16 | call to ymlStep | provenance | |
18-
| test.cpp:13:10:13:16 | call to ymlStep | test.cpp:15:10:15:10 | y | provenance | Sink:MaD:949 |
18+
| test.cpp:13:10:13:16 | call to ymlStep | test.cpp:15:10:15:10 | y | provenance | Sink:MaD:953 |
1919
| test.cpp:13:18:13:18 | x | test.cpp:4:5:4:11 | [summary param] 0 in ymlStep | provenance | |
20-
| test.cpp:13:18:13:18 | x | test.cpp:13:10:13:16 | call to ymlStep | provenance | MaD:950 |
20+
| test.cpp:13:18:13:18 | x | test.cpp:13:10:13:16 | call to ymlStep | provenance | MaD:954 |
2121
nodes
2222
| asio_streams.cpp:56:18:56:23 | [summary param] *0 in buffer | semmle.label | [summary param] *0 in buffer |
2323
| asio_streams.cpp:56:18:56:23 | [summary] to write: ReturnValue in buffer | semmle.label | [summary] to write: ReturnValue in buffer |

cpp/ql/test/library-tests/dataflow/external-models/validatemodels.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
| Dubious member name "operator LPSTR" in summary model. |
66
| Dubious member name "operator LPWSTR" in summary model. |
77
| Dubious member name "operator PCXSTR" in summary model. |
8+
| Dubious member name "operator PXSTR" in summary model. |
89
| Dubious member name "operator&" in summary model. |
910
| Dubious member name "operator*" in summary model. |
1011
| Dubious member name "operator+" in summary model. |

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,7 +1217,7 @@ struct CStringData {
12171217

12181218
void test_CStringData() {
12191219
CStringData d = source<CStringData>();
1220-
sink(d.data()); // $ MISSING: ir
1220+
sink(d.data()); // $ ir
12211221
}
12221222

12231223
template<typename TCharType>
@@ -1237,6 +1237,6 @@ struct CStrBufT {
12371237
void test_CStrBufT() {
12381238
CStringT<char> s = source<CStringT<char>>();
12391239
CStrBufT<char> b(s, 42, 0);
1240-
sink(static_cast<CStrBufT<char>::PCXSTR>(b)); // $ MISSING: ir
1241-
sink(static_cast<CStrBufT<char>::PXSTR>(b)); // $ MISSING: ir
1240+
sink(static_cast<CStrBufT<char>::PCXSTR>(b)); // $ ir
1241+
sink(static_cast<CStrBufT<char>::PXSTR>(b)); // $ ir
12421242
}

0 commit comments

Comments
 (0)