Skip to content

Commit

Permalink
C++: Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
calumgrant committed Dec 19, 2024
1 parent fabaceb commit e067ac9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
category: minorAnalysis
---
* The "Returning stack-allocated memory" query (`cpp/return-stack-allocated-memory`) no longer produces results if there is an extraction error in the type of the function.
* The "Returning stack-allocated memory" query (`cpp/return-stack-allocated-memory`) no longer produces results if there is an extraction error in the returned expression.
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,3 @@ void* test_strndupa(const char* s, size_t size) {
return s2; // BAD
}

UNKNOWN_TYPE test_error_type() {
UNKNOWN_TYPE x;
return x; // GOOD: Don't report error types
}
Original file line number Diff line number Diff line change
@@ -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; // GOOD: Don't know what &x means
}

int* test_error_pointer_member() {
UNKNOWN_TYPE x;
return &x.y; // GOOD: Don't know what x.y means
}

0 comments on commit e067ac9

Please sign in to comment.