File tree Expand file tree Collapse file tree 5 files changed +48
-1
lines changed
cpp/ql/test/library-tests/dataflow/taint-tests Expand file tree Collapse file tree 5 files changed +48
-1
lines changed Original file line number Diff line number Diff line change 512
512
| taint.cpp:444:7:444:7 | d [post update] | taint.cpp:447:7:447:7 | d | |
513
513
| taint.cpp:445:2:445:2 | d [post update] | taint.cpp:446:7:446:7 | d | |
514
514
| taint.cpp:445:2:445:2 | d [post update] | taint.cpp:447:7:447:7 | d | |
515
+ | taint.cpp:452:16:452:16 | a | taint.cpp:454:10:454:10 | a | |
516
+ | taint.cpp:452:24:452:24 | b | taint.cpp:455:6:455:6 | b | |
517
+ | taint.cpp:454:10:454:10 | a | taint.cpp:456:6:456:6 | c | |
518
+ | taint.cpp:455:6:455:6 | b | taint.cpp:452:16:452:16 | a | |
519
+ | taint.cpp:455:6:455:6 | b | taint.cpp:455:2:455:6 | ... = ... | |
520
+ | taint.cpp:456:6:456:6 | c | taint.cpp:452:24:452:24 | b | |
521
+ | taint.cpp:456:6:456:6 | c | taint.cpp:456:2:456:6 | ... = ... | |
522
+ | taint.cpp:462:6:462:11 | call to source | taint.cpp:462:2:462:13 | ... = ... | |
523
+ | taint.cpp:462:6:462:11 | call to source | taint.cpp:465:7:465:7 | x | |
524
+ | taint.cpp:462:6:462:11 | call to source | taint.cpp:468:7:468:7 | x | |
525
+ | taint.cpp:462:6:462:11 | call to source | taint.cpp:470:7:470:7 | x | |
526
+ | taint.cpp:463:6:463:6 | 0 | taint.cpp:463:2:463:6 | ... = ... | |
527
+ | taint.cpp:463:6:463:6 | 0 | taint.cpp:466:7:466:7 | y | |
528
+ | taint.cpp:463:6:463:6 | 0 | taint.cpp:468:10:468:10 | y | |
529
+ | taint.cpp:463:6:463:6 | 0 | taint.cpp:471:7:471:7 | y | |
530
+ | taint.cpp:468:7:468:7 | ref arg x | taint.cpp:470:7:470:7 | x | |
531
+ | taint.cpp:468:10:468:10 | ref arg y | taint.cpp:471:7:471:7 | y | |
Original file line number Diff line number Diff line change @@ -195,7 +195,7 @@ void test_memcpy(int *source) {
195
195
sink (x);
196
196
}
197
197
198
- // --- swap ---
198
+ // --- std:: swap ---
199
199
200
200
namespace std {
201
201
template <class T > constexpr void swap (T& a, T& b);
@@ -446,3 +446,27 @@ void test_qualifiers()
446
446
sink (d); // tainted
447
447
sink (d.getString ()); // tainted
448
448
}
449
+
450
+ // --- non-standard swap ---
451
+
452
+ void swop (int &a, int &b)
453
+ {
454
+ int c = a;
455
+ a = b;
456
+ b = c;
457
+ }
458
+
459
+ void test_swop () {
460
+ int x, y;
461
+
462
+ x = source ();
463
+ y = 0 ;
464
+
465
+ sink (x); // tainted
466
+ sink (y); // clean
467
+
468
+ swop (x, y);
469
+
470
+ sink (x); // clean [FALSE POSITIVE]
471
+ sink (y); // tainted
472
+ }
Original file line number Diff line number Diff line change 58
58
| taint.cpp:439:10:439:18 | call to getMember | taint.cpp:437:15:437:20 | call to source |
59
59
| taint.cpp:446:7:446:7 | d | taint.cpp:445:14:445:28 | call to source |
60
60
| taint.cpp:447:9:447:17 | call to getString | taint.cpp:445:14:445:28 | call to source |
61
+ | taint.cpp:465:7:465:7 | x | taint.cpp:462:6:462:11 | call to source |
62
+ | taint.cpp:470:7:470:7 | x | taint.cpp:462:6:462:11 | call to source |
63
+ | taint.cpp:471:7:471:7 | y | taint.cpp:462:6:462:11 | call to source |
Original file line number Diff line number Diff line change 42
42
| taint.cpp:439:10:439:18 | taint.cpp:437:15:437:20 | AST only |
43
43
| taint.cpp:446:7:446:7 | taint.cpp:445:14:445:28 | AST only |
44
44
| taint.cpp:447:9:447:17 | taint.cpp:445:14:445:28 | AST only |
45
+ | taint.cpp:471:7:471:7 | taint.cpp:462:6:462:11 | AST only |
Original file line number Diff line number Diff line change 20
20
| taint.cpp:382:7:382:7 | a | taint.cpp:377:23:377:28 | source |
21
21
| taint.cpp:429:7:429:7 | b | taint.cpp:428:13:428:18 | call to source |
22
22
| taint.cpp:430:9:430:14 | member | taint.cpp:428:13:428:18 | call to source |
23
+ | taint.cpp:465:7:465:7 | x | taint.cpp:462:6:462:11 | call to source |
24
+ | taint.cpp:470:7:470:7 | x | taint.cpp:462:6:462:11 | call to source |
You can’t perform that action at this time.
0 commit comments