C++: Fix FPs to cpp/return-stack-allocated-memory

This commit is contained in:
Calum Grant
2024-12-17 15:58:39 +00:00
parent 8efd870192
commit 14cef6a207
2 changed files with 9 additions and 2 deletions

View File

@@ -92,6 +92,8 @@ class ReturnStackAllocatedMemoryConfig extends MustFlowConfiguration {
or
node2.(PointerOffsetInstruction).getLeftOperand() = node1
}
override predicate isBarrier(Instruction n) { n.getResultType() instanceof ErroneousType }
}
from

View File

@@ -1,4 +1,4 @@
// semmle-extractor-options: -std=c++14
// semmle-extractor-options: -std=c++14 --expect_errors
class MyClass
{
public:
@@ -248,4 +248,9 @@ char* test_strdupa(const char* s) {
void* test_strndupa(const char* s, size_t size) {
char* s2 = strndupa(s, size);
return s2; // BAD
}
}
UNKNOWN_TYPE test_error_type() {
UNKNOWN_TYPE x;
return x; // GOOD: Don't report error types
}