Skip to content

Commit 8c07a3e

Browse files
committed
C++: Add testcase with missing model.
1 parent 7c05622 commit 8c07a3e

File tree

3 files changed

+61
-43
lines changed

3 files changed

+61
-43
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,6 +1347,12 @@ void test_CopyTo()
13471347
Microsoft::WRL::ComPtr<int> p2;
13481348
p1.CopyTo(nullptr, (void**)&raw);
13491349
sink(*raw); // $ ir MISSING: ast
1350+
1351+
Microsoft::WRL::ComPtr<int> p3(new int(x));
1352+
1353+
int* raw2 = nullptr;
1354+
p3.CopyTo<int>(&raw2);
1355+
sink(*raw2); // $ MISSING: ast,ir
13501356
}
13511357

13521358
void test_Swap()

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

Lines changed: 54 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,70 +1328,81 @@ WARNING: module 'TaintTracking' has been deprecated and may be removed in future
13281328
| atl.cpp:1336:9:1336:10 | ref arg p2 | atl.cpp:1337:1:1337:1 | p2 | |
13291329
| atl.cpp:1336:12:1336:14 | call to Get | atl.cpp:1336:8:1336:16 | * ... | TAINT |
13301330
| atl.cpp:1341:11:1341:21 | call to source | atl.cpp:1342:42:1342:42 | x | |
1331+
| atl.cpp:1341:11:1341:21 | call to source | atl.cpp:1351:42:1351:42 | x | |
13311332
| atl.cpp:1342:34:1342:43 | new | atl.cpp:1342:34:1342:44 | call to ComPtr | TAINT |
13321333
| atl.cpp:1342:34:1342:44 | call to ComPtr | atl.cpp:1344:3:1344:4 | p1 | |
13331334
| atl.cpp:1342:34:1342:44 | call to ComPtr | atl.cpp:1348:3:1348:4 | p1 | |
1334-
| atl.cpp:1342:34:1342:44 | call to ComPtr | atl.cpp:1350:1:1350:1 | p1 | |
1335+
| atl.cpp:1342:34:1342:44 | call to ComPtr | atl.cpp:1356:1:1356:1 | p1 | |
13351336
| atl.cpp:1342:42:1342:42 | x | atl.cpp:1342:34:1342:43 | new | |
13361337
| atl.cpp:1343:14:1343:20 | 0 | atl.cpp:1344:14:1344:16 | raw | |
13371338
| atl.cpp:1343:14:1343:20 | 0 | atl.cpp:1345:9:1345:11 | raw | |
13381339
| atl.cpp:1343:14:1343:20 | 0 | atl.cpp:1348:31:1348:33 | raw | |
13391340
| atl.cpp:1343:14:1343:20 | 0 | atl.cpp:1349:9:1349:11 | raw | |
13401341
| atl.cpp:1344:3:1344:4 | ref arg p1 | atl.cpp:1348:3:1348:4 | p1 | |
1341-
| atl.cpp:1344:3:1344:4 | ref arg p1 | atl.cpp:1350:1:1350:1 | p1 | |
1342+
| atl.cpp:1344:3:1344:4 | ref arg p1 | atl.cpp:1356:1:1356:1 | p1 | |
13421343
| atl.cpp:1344:13:1344:16 | ref arg & ... | atl.cpp:1344:14:1344:16 | raw [inner post update] | |
13431344
| atl.cpp:1344:13:1344:16 | ref arg & ... | atl.cpp:1345:9:1345:11 | raw | |
13441345
| atl.cpp:1344:13:1344:16 | ref arg & ... | atl.cpp:1348:31:1348:33 | raw | |
13451346
| atl.cpp:1344:13:1344:16 | ref arg & ... | atl.cpp:1349:9:1349:11 | raw | |
13461347
| atl.cpp:1344:14:1344:16 | raw | atl.cpp:1344:13:1344:16 | & ... | |
13471348
| atl.cpp:1345:9:1345:11 | raw | atl.cpp:1345:8:1345:11 | * ... | TAINT |
1348-
| atl.cpp:1347:31:1347:32 | call to ComPtr | atl.cpp:1350:1:1350:1 | p2 | |
1349+
| atl.cpp:1347:31:1347:32 | call to ComPtr | atl.cpp:1356:1:1356:1 | p2 | |
13491350
| atl.cpp:1348:30:1348:33 | ref arg & ... | atl.cpp:1348:31:1348:33 | raw [inner post update] | |
13501351
| atl.cpp:1348:30:1348:33 | ref arg & ... | atl.cpp:1349:9:1349:11 | raw | |
13511352
| atl.cpp:1348:31:1348:33 | raw | atl.cpp:1348:30:1348:33 | & ... | |
13521353
| atl.cpp:1349:9:1349:11 | raw | atl.cpp:1349:8:1349:11 | * ... | TAINT |
1353-
| atl.cpp:1354:11:1354:21 | call to source | atl.cpp:1355:42:1355:42 | x | |
1354-
| atl.cpp:1355:34:1355:43 | new | atl.cpp:1355:34:1355:44 | call to ComPtr | TAINT |
1355-
| atl.cpp:1355:34:1355:44 | call to ComPtr | atl.cpp:1357:3:1357:4 | p1 | |
1356-
| atl.cpp:1355:34:1355:44 | call to ComPtr | atl.cpp:1359:9:1359:10 | p1 | |
1357-
| atl.cpp:1355:34:1355:44 | call to ComPtr | atl.cpp:1360:1:1360:1 | p1 | |
1358-
| atl.cpp:1355:42:1355:42 | x | atl.cpp:1355:34:1355:43 | new | |
1359-
| atl.cpp:1356:31:1356:32 | call to ComPtr | atl.cpp:1357:11:1357:12 | p2 | |
1360-
| atl.cpp:1356:31:1356:32 | call to ComPtr | atl.cpp:1358:9:1358:10 | p2 | |
1361-
| atl.cpp:1356:31:1356:32 | call to ComPtr | atl.cpp:1360:1:1360:1 | p2 | |
1362-
| atl.cpp:1357:3:1357:4 | ref arg p1 | atl.cpp:1359:9:1359:10 | p1 | |
1363-
| atl.cpp:1357:3:1357:4 | ref arg p1 | atl.cpp:1360:1:1360:1 | p1 | |
1364-
| atl.cpp:1357:11:1357:12 | ref arg p2 | atl.cpp:1358:9:1358:10 | p2 | |
1365-
| atl.cpp:1357:11:1357:12 | ref arg p2 | atl.cpp:1360:1:1360:1 | p2 | |
1366-
| atl.cpp:1358:9:1358:10 | ref arg p2 | atl.cpp:1360:1:1360:1 | p2 | |
1367-
| atl.cpp:1358:12:1358:14 | call to Get | atl.cpp:1358:8:1358:16 | * ... | TAINT |
1368-
| atl.cpp:1359:9:1359:10 | ref arg p1 | atl.cpp:1360:1:1360:1 | p1 | |
1369-
| atl.cpp:1359:12:1359:14 | call to Get | atl.cpp:1359:8:1359:16 | * ... | TAINT |
1370-
| atl.cpp:1364:11:1364:21 | call to source | atl.cpp:1365:42:1365:42 | x | |
1371-
| atl.cpp:1364:11:1364:21 | call to source | atl.cpp:1368:48:1368:48 | x | |
1372-
| atl.cpp:1364:11:1364:21 | call to source | atl.cpp:1371:42:1371:42 | x | |
1373-
| atl.cpp:1365:34:1365:43 | new | atl.cpp:1365:34:1365:44 | call to ComPtr | TAINT |
1374-
| atl.cpp:1365:34:1365:44 | call to ComPtr | atl.cpp:1366:10:1366:11 | p1 | |
1375-
| atl.cpp:1365:34:1365:44 | call to ComPtr | atl.cpp:1374:1:1374:1 | p1 | |
1376-
| atl.cpp:1365:42:1365:42 | x | atl.cpp:1365:34:1365:43 | new | |
1377-
| atl.cpp:1366:9:1366:26 | * ... | atl.cpp:1366:8:1366:26 | * ... | TAINT |
1378-
| atl.cpp:1366:10:1366:11 | ref arg p1 | atl.cpp:1374:1:1374:1 | p1 | |
1379-
| atl.cpp:1366:13:1366:24 | call to GetAddressOf | atl.cpp:1366:9:1366:26 | * ... | TAINT |
1380-
| atl.cpp:1368:40:1368:49 | new | atl.cpp:1368:40:1368:50 | call to ComPtr | TAINT |
1381-
| atl.cpp:1368:40:1368:50 | call to ComPtr | atl.cpp:1369:10:1369:11 | p2 | |
1382-
| atl.cpp:1368:40:1368:50 | call to ComPtr | atl.cpp:1374:1:1374:1 | p2 | |
1383-
| atl.cpp:1368:48:1368:48 | x | atl.cpp:1368:40:1368:49 | new | |
1384-
| atl.cpp:1369:9:1369:26 | * ... | atl.cpp:1369:8:1369:26 | * ... | TAINT |
1385-
| atl.cpp:1369:10:1369:11 | ref arg p2 | atl.cpp:1374:1:1374:1 | p2 | |
1386-
| atl.cpp:1369:13:1369:24 | call to GetAddressOf | atl.cpp:1369:9:1369:26 | * ... | TAINT |
1354+
| atl.cpp:1351:34:1351:43 | new | atl.cpp:1351:34:1351:44 | call to ComPtr | TAINT |
1355+
| atl.cpp:1351:34:1351:44 | call to ComPtr | atl.cpp:1354:3:1354:4 | p3 | |
1356+
| atl.cpp:1351:34:1351:44 | call to ComPtr | atl.cpp:1356:1:1356:1 | p3 | |
1357+
| atl.cpp:1351:42:1351:42 | x | atl.cpp:1351:34:1351:43 | new | |
1358+
| atl.cpp:1353:15:1353:21 | 0 | atl.cpp:1354:19:1354:22 | raw2 | |
1359+
| atl.cpp:1353:15:1353:21 | 0 | atl.cpp:1355:9:1355:12 | raw2 | |
1360+
| atl.cpp:1354:18:1354:22 | ref arg & ... | atl.cpp:1354:19:1354:22 | raw2 [inner post update] | |
1361+
| atl.cpp:1354:18:1354:22 | ref arg & ... | atl.cpp:1355:9:1355:12 | raw2 | |
1362+
| atl.cpp:1354:19:1354:22 | raw2 | atl.cpp:1354:18:1354:22 | & ... | |
1363+
| atl.cpp:1355:9:1355:12 | raw2 | atl.cpp:1355:8:1355:12 | * ... | TAINT |
1364+
| atl.cpp:1360:11:1360:21 | call to source | atl.cpp:1361:42:1361:42 | x | |
1365+
| atl.cpp:1361:34:1361:43 | new | atl.cpp:1361:34:1361:44 | call to ComPtr | TAINT |
1366+
| atl.cpp:1361:34:1361:44 | call to ComPtr | atl.cpp:1363:3:1363:4 | p1 | |
1367+
| atl.cpp:1361:34:1361:44 | call to ComPtr | atl.cpp:1365:9:1365:10 | p1 | |
1368+
| atl.cpp:1361:34:1361:44 | call to ComPtr | atl.cpp:1366:1:1366:1 | p1 | |
1369+
| atl.cpp:1361:42:1361:42 | x | atl.cpp:1361:34:1361:43 | new | |
1370+
| atl.cpp:1362:31:1362:32 | call to ComPtr | atl.cpp:1363:11:1363:12 | p2 | |
1371+
| atl.cpp:1362:31:1362:32 | call to ComPtr | atl.cpp:1364:9:1364:10 | p2 | |
1372+
| atl.cpp:1362:31:1362:32 | call to ComPtr | atl.cpp:1366:1:1366:1 | p2 | |
1373+
| atl.cpp:1363:3:1363:4 | ref arg p1 | atl.cpp:1365:9:1365:10 | p1 | |
1374+
| atl.cpp:1363:3:1363:4 | ref arg p1 | atl.cpp:1366:1:1366:1 | p1 | |
1375+
| atl.cpp:1363:11:1363:12 | ref arg p2 | atl.cpp:1364:9:1364:10 | p2 | |
1376+
| atl.cpp:1363:11:1363:12 | ref arg p2 | atl.cpp:1366:1:1366:1 | p2 | |
1377+
| atl.cpp:1364:9:1364:10 | ref arg p2 | atl.cpp:1366:1:1366:1 | p2 | |
1378+
| atl.cpp:1364:12:1364:14 | call to Get | atl.cpp:1364:8:1364:16 | * ... | TAINT |
1379+
| atl.cpp:1365:9:1365:10 | ref arg p1 | atl.cpp:1366:1:1366:1 | p1 | |
1380+
| atl.cpp:1365:12:1365:14 | call to Get | atl.cpp:1365:8:1365:16 | * ... | TAINT |
1381+
| atl.cpp:1370:11:1370:21 | call to source | atl.cpp:1371:42:1371:42 | x | |
1382+
| atl.cpp:1370:11:1370:21 | call to source | atl.cpp:1374:48:1374:48 | x | |
1383+
| atl.cpp:1370:11:1370:21 | call to source | atl.cpp:1377:42:1377:42 | x | |
13871384
| atl.cpp:1371:34:1371:43 | new | atl.cpp:1371:34:1371:44 | call to ComPtr | TAINT |
1388-
| atl.cpp:1371:34:1371:44 | call to ComPtr | atl.cpp:1372:14:1372:15 | p3 | |
1389-
| atl.cpp:1371:34:1371:44 | call to ComPtr | atl.cpp:1374:1:1374:1 | p3 | |
1385+
| atl.cpp:1371:34:1371:44 | call to ComPtr | atl.cpp:1372:10:1372:11 | p1 | |
1386+
| atl.cpp:1371:34:1371:44 | call to ComPtr | atl.cpp:1380:1:1380:1 | p1 | |
13901387
| atl.cpp:1371:42:1371:42 | x | atl.cpp:1371:34:1371:43 | new | |
1391-
| atl.cpp:1372:14:1372:15 | ref arg p3 | atl.cpp:1374:1:1374:1 | p3 | |
1392-
| atl.cpp:1372:17:1372:38 | call to ReleaseAndGetAddressOf | atl.cpp:1373:10:1373:11 | pp | |
1393-
| atl.cpp:1373:9:1373:11 | * ... | atl.cpp:1373:8:1373:11 | * ... | TAINT |
1394-
| atl.cpp:1373:10:1373:11 | pp | atl.cpp:1373:9:1373:11 | * ... | TAINT |
1388+
| atl.cpp:1372:9:1372:26 | * ... | atl.cpp:1372:8:1372:26 | * ... | TAINT |
1389+
| atl.cpp:1372:10:1372:11 | ref arg p1 | atl.cpp:1380:1:1380:1 | p1 | |
1390+
| atl.cpp:1372:13:1372:24 | call to GetAddressOf | atl.cpp:1372:9:1372:26 | * ... | TAINT |
1391+
| atl.cpp:1374:40:1374:49 | new | atl.cpp:1374:40:1374:50 | call to ComPtr | TAINT |
1392+
| atl.cpp:1374:40:1374:50 | call to ComPtr | atl.cpp:1375:10:1375:11 | p2 | |
1393+
| atl.cpp:1374:40:1374:50 | call to ComPtr | atl.cpp:1380:1:1380:1 | p2 | |
1394+
| atl.cpp:1374:48:1374:48 | x | atl.cpp:1374:40:1374:49 | new | |
1395+
| atl.cpp:1375:9:1375:26 | * ... | atl.cpp:1375:8:1375:26 | * ... | TAINT |
1396+
| atl.cpp:1375:10:1375:11 | ref arg p2 | atl.cpp:1380:1:1380:1 | p2 | |
1397+
| atl.cpp:1375:13:1375:24 | call to GetAddressOf | atl.cpp:1375:9:1375:26 | * ... | TAINT |
1398+
| atl.cpp:1377:34:1377:43 | new | atl.cpp:1377:34:1377:44 | call to ComPtr | TAINT |
1399+
| atl.cpp:1377:34:1377:44 | call to ComPtr | atl.cpp:1378:14:1378:15 | p3 | |
1400+
| atl.cpp:1377:34:1377:44 | call to ComPtr | atl.cpp:1380:1:1380:1 | p3 | |
1401+
| atl.cpp:1377:42:1377:42 | x | atl.cpp:1377:34:1377:43 | new | |
1402+
| atl.cpp:1378:14:1378:15 | ref arg p3 | atl.cpp:1380:1:1380:1 | p3 | |
1403+
| atl.cpp:1378:17:1378:38 | call to ReleaseAndGetAddressOf | atl.cpp:1379:10:1379:11 | pp | |
1404+
| atl.cpp:1379:9:1379:11 | * ... | atl.cpp:1379:8:1379:11 | * ... | TAINT |
1405+
| atl.cpp:1379:10:1379:11 | pp | atl.cpp:1379:9:1379:11 | * ... | TAINT |
13951406
| bsd.cpp:17:11:17:16 | call to source | bsd.cpp:20:18:20:18 | s | |
13961407
| bsd.cpp:18:12:18:15 | addr | bsd.cpp:20:22:20:25 | addr | |
13971408
| bsd.cpp:18:12:18:15 | addr | bsd.cpp:23:8:23:11 | addr | |

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46427,6 +46427,7 @@ getParameterTypeName
4642746427
| atl.cpp:1285:13:1285:18 | CopyTo | 0 | GUID * |
4642846428
| atl.cpp:1285:13:1285:18 | CopyTo | 0 | REFIID |
4642946429
| atl.cpp:1285:13:1285:18 | CopyTo | 1 | void ** |
46430+
| atl.cpp:1288:13:1288:18 | CopyTo | 0 | func:0 ** |
4643046431
| atl.cpp:1303:10:1303:13 | Swap | 0 | ComPtr & |
4643146432
| atl.cpp:1310:25:1310:28 | move | 0 | func:0 & |
4643246433
| bsd.cpp:6:8:6:8 | operator= | 0 | const sockaddr & |

0 commit comments

Comments
 (0)