Skip to content

Commit 7b8a51f

Browse files
committed
C++: Add test with missing result.
1 parent 47a419a commit 7b8a51f

File tree

1 file changed

+7
-1
lines changed
  • cpp/ql/test/experimental/query-tests/Security/CWE/CWE-570/semmle/tests

1 file changed

+7
-1
lines changed

cpp/ql/test/experimental/query-tests/Security/CWE/CWE-570/semmle/tests/test.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,4 +205,10 @@ void bad_new_with_nonthrowing_call() {
205205
Foo f;
206206
if(f) { }
207207
} catch(...) { }
208-
}
208+
}
209+
210+
void bad_new_catch_baseclass_of_bad_alloc() {
211+
try {
212+
int* p = new(std::nothrow) int; // BAD [NOT DETECTED]
213+
} catch(const std::exception&) { }
214+
}

0 commit comments

Comments
 (0)