Skip to content

Commit 7a1b85a

Browse files
committed
C++: Add FP test.
1 parent 880262d commit 7a1b85a

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
| test.cpp:702:27:702:27 | call to operator[] | This object is destroyed at the end of the full-expression. |
55
| test.cpp:727:23:727:23 | call to operator[] | This object is destroyed at the end of the full-expression. |
66
| test.cpp:735:23:735:23 | call to operator[] | This object is destroyed at the end of the full-expression. |
7+
| test.cpp:803:3:803:3 | pointer to ~vector output argument | This object is destroyed at the end of the full-expression. |

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,4 +792,13 @@ void test4() {
792792
// function we may end up in the destructor call `chunk.~A()`in `A.foo`. This destructor
793793
// call can flow to `begin` through the back-edge and cause a strange FP.
794794
auto zero = A().size();
795+
}
796+
797+
void test5(int i)
798+
{
799+
while(i < 10) {
800+
const auto& vvs = returnValue();
801+
for(const auto& vs : vvs) { }
802+
++i;
803+
} // GOOD [FALSE POSITIVE]
795804
}

0 commit comments

Comments
 (0)