mirror of
https://github.com/github/codeql.git
synced 2026-04-20 22:44:52 +02:00
C++: Fix FPs to cpp/return-stack-allocated-memory
This commit is contained in:
@@ -92,6 +92,8 @@ class ReturnStackAllocatedMemoryConfig extends MustFlowConfiguration {
|
||||
or
|
||||
node2.(PointerOffsetInstruction).getLeftOperand() = node1
|
||||
}
|
||||
|
||||
override predicate isBarrier(Instruction n) { n.getResultType() instanceof ErroneousType }
|
||||
}
|
||||
|
||||
from
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user