Skip to content

Commit b201fd0

Browse files
authored
Merge pull request #16232 from MathiasVP/add-iterator-to-expired-container-fp
C++: Add `cpp/iterator-to-expired-container` FP test
2 parents f78ea26 + 62299dc commit b201fd0

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

cpp/ql/test/experimental/query-tests/Security/CWE/CWE-416/IteratorToExpiredContainer.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@
1212
| test.cpp:727:23:727:23 | call to operator[] | This object is destroyed before $@ is called. | test.cpp:750:17:750:17 | call to end | call to end |
1313
| test.cpp:735:23:735:23 | call to operator[] | This object is destroyed before $@ is called. | test.cpp:759:17:759:17 | call to begin | call to begin |
1414
| test.cpp:735:23:735:23 | call to operator[] | This object is destroyed before $@ is called. | test.cpp:759:17:759:17 | call to end | call to end |
15+
| test.cpp:771:44:771:56 | temporary object | This object is destroyed before $@ is called. | test.cpp:772:35:772:35 | call to begin | call to begin |
16+
| test.cpp:771:44:771:56 | temporary object | This object is destroyed before $@ is called. | test.cpp:772:35:772:35 | call to end | call to end |

cpp/ql/test/experimental/query-tests/Security/CWE/CWE-416/test.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,3 +766,8 @@ void test2() {
766766
for (auto x : value) {}
767767
}
768768
}
769+
770+
void test3() {
771+
const std::vector<std::vector<int>>& v = returnValue(); // GOOD [FALSE POSITIVE]
772+
for(const std::vector<int>& x : v) {}
773+
}

0 commit comments

Comments
 (0)