Skip to content

Commit 126615a

Browse files
author
Robert Marsh
committed
C++: add prefix operator++ in inserter tests
1 parent fbe9bc8 commit 126615a

File tree

4 files changed

+49
-1
lines changed

4 files changed

+49
-1
lines changed

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7113,6 +7113,7 @@
71137113
| vector.cpp:414:7:414:9 | ref arg v14 | vector.cpp:415:1:415:1 | v14 | |
71147114
| vector.cpp:417:33:417:45 | source_string | vector.cpp:421:23:421:35 | source_string | |
71157115
| vector.cpp:417:33:417:45 | source_string | vector.cpp:428:23:428:35 | source_string | |
7116+
| vector.cpp:417:33:417:45 | source_string | vector.cpp:442:23:442:35 | source_string | |
71167117
| vector.cpp:419:28:419:30 | call to vector | vector.cpp:420:13:420:15 | out | |
71177118
| vector.cpp:419:28:419:30 | call to vector | vector.cpp:422:8:422:10 | out | |
71187119
| vector.cpp:419:28:419:30 | call to vector | vector.cpp:423:2:423:2 | out | |
@@ -7158,3 +7159,32 @@
71587159
| vector.cpp:435:6:435:6 | ref arg call to operator++ | vector.cpp:435:4:435:5 | ref arg it | |
71597160
| vector.cpp:435:11:435:16 | call to source | vector.cpp:435:3:435:3 | ref arg call to operator* | TAINT |
71607161
| vector.cpp:436:8:436:10 | ref arg out | vector.cpp:437:2:437:2 | out | |
7162+
| vector.cpp:440:28:440:30 | call to vector | vector.cpp:441:32:441:34 | out | |
7163+
| vector.cpp:440:28:440:30 | call to vector | vector.cpp:443:8:443:10 | out | |
7164+
| vector.cpp:440:28:440:30 | call to vector | vector.cpp:444:2:444:2 | out | |
7165+
| vector.cpp:441:13:441:30 | call to back_inserter | vector.cpp:442:6:442:7 | it | |
7166+
| vector.cpp:441:32:441:34 | ref arg out | vector.cpp:443:8:443:10 | out | |
7167+
| vector.cpp:441:32:441:34 | ref arg out | vector.cpp:444:2:444:2 | out | |
7168+
| vector.cpp:442:3:442:3 | ref arg call to operator* | vector.cpp:442:4:442:4 | ref arg call to operator++ | TAINT |
7169+
| vector.cpp:442:3:442:3 | ref arg call to operator* | vector.cpp:443:8:443:10 | out | |
7170+
| vector.cpp:442:3:442:3 | ref arg call to operator* | vector.cpp:444:2:444:2 | out | |
7171+
| vector.cpp:442:4:442:4 | call to operator++ | vector.cpp:442:3:442:3 | call to operator* | TAINT |
7172+
| vector.cpp:442:4:442:4 | ref arg call to operator++ | vector.cpp:442:6:442:7 | ref arg it | |
7173+
| vector.cpp:442:6:442:7 | it | vector.cpp:442:4:442:4 | call to operator++ | |
7174+
| vector.cpp:442:11:442:36 | call to basic_string | vector.cpp:442:3:442:3 | ref arg call to operator* | TAINT |
7175+
| vector.cpp:442:23:442:35 | source_string | vector.cpp:442:11:442:36 | call to basic_string | TAINT |
7176+
| vector.cpp:443:8:443:10 | ref arg out | vector.cpp:444:2:444:2 | out | |
7177+
| vector.cpp:447:20:447:22 | call to vector | vector.cpp:448:32:448:34 | out | |
7178+
| vector.cpp:447:20:447:22 | call to vector | vector.cpp:450:8:450:10 | out | |
7179+
| vector.cpp:447:20:447:22 | call to vector | vector.cpp:451:2:451:2 | out | |
7180+
| vector.cpp:448:13:448:30 | call to back_inserter | vector.cpp:449:6:449:7 | it | |
7181+
| vector.cpp:448:32:448:34 | ref arg out | vector.cpp:450:8:450:10 | out | |
7182+
| vector.cpp:448:32:448:34 | ref arg out | vector.cpp:451:2:451:2 | out | |
7183+
| vector.cpp:449:3:449:3 | ref arg call to operator* | vector.cpp:449:4:449:4 | ref arg call to operator++ | TAINT |
7184+
| vector.cpp:449:3:449:3 | ref arg call to operator* | vector.cpp:450:8:450:10 | out | |
7185+
| vector.cpp:449:3:449:3 | ref arg call to operator* | vector.cpp:451:2:451:2 | out | |
7186+
| vector.cpp:449:4:449:4 | call to operator++ | vector.cpp:449:3:449:3 | call to operator* | TAINT |
7187+
| vector.cpp:449:4:449:4 | ref arg call to operator++ | vector.cpp:449:6:449:7 | ref arg it | |
7188+
| vector.cpp:449:6:449:7 | it | vector.cpp:449:4:449:4 | call to operator++ | |
7189+
| vector.cpp:449:11:449:16 | call to source | vector.cpp:449:3:449:3 | ref arg call to operator* | TAINT |
7190+
| vector.cpp:450:8:450:10 | ref arg out | vector.cpp:451:2:451:2 | out | |

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,3 +659,5 @@
659659
| vector.cpp:422:8:422:10 | out | vector.cpp:417:33:417:45 | source_string |
660660
| vector.cpp:429:8:429:10 | out | vector.cpp:417:33:417:45 | source_string |
661661
| vector.cpp:436:8:436:10 | out | vector.cpp:435:11:435:16 | call to source |
662+
| vector.cpp:443:8:443:10 | out | vector.cpp:417:33:417:45 | source_string |
663+
| vector.cpp:450:8:450:10 | out | vector.cpp:449:11:449:16 | call to source |

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,3 +385,5 @@
385385
| vector.cpp:422:8:422:10 | vector.cpp:417:33:417:45 | AST only |
386386
| vector.cpp:429:8:429:10 | vector.cpp:417:33:417:45 | AST only |
387387
| vector.cpp:436:8:436:10 | vector.cpp:435:11:435:16 | AST only |
388+
| vector.cpp:443:8:443:10 | vector.cpp:417:33:417:45 | AST only |
389+
| vector.cpp:450:8:450:10 | vector.cpp:449:11:449:16 | AST only |

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,4 +435,18 @@ void test_vector_inserter(char *source_string) {
435435
*it++ = source();
436436
sink(out); // tainted [NOT DETECTED]
437437
}
438-
}
438+
439+
{
440+
std::vector<std::string> out;
441+
auto it = std::back_inserter(out);
442+
*++it = std::string(source_string);
443+
sink(out); // tainted [NOT DETECTED]
444+
}
445+
446+
{
447+
std::vector<int> out;
448+
auto it = std::back_inserter(out);
449+
*++it = source();
450+
sink(out); // tainted [NOT DETECTED]
451+
}
452+
}

0 commit comments

Comments
 (0)