mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Merge pull request #18309 from github/calumgrant/bmn/return-stack-allocated-memory
C++: Fix FPs to cpp/return-stack-allocated-memory
This commit is contained in:
@@ -248,4 +248,5 @@ char* test_strdupa(const char* s) {
|
||||
void* test_strndupa(const char* s, size_t size) {
|
||||
char* s2 = strndupa(s, size);
|
||||
return s2; // BAD
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
// semmle-extractor-options: --expect_errors
|
||||
|
||||
UNKNOWN_TYPE test_error_value() {
|
||||
UNKNOWN_TYPE x;
|
||||
return x; // GOOD: Error return type
|
||||
}
|
||||
|
||||
void* test_error_pointer() {
|
||||
UNKNOWN_TYPE x;
|
||||
return &x; // BAD [FALSE NEGATIVE]
|
||||
}
|
||||
|
||||
int* test_error_pointer_member() {
|
||||
UNKNOWN_TYPE x;
|
||||
return &x.y; // BAD [FALSE NEGATIVE]
|
||||
}
|
||||
Reference in New Issue
Block a user