-
Notifications
You must be signed in to change notification settings - Fork 1.9k
C++: Fix FPs to cpp/return-stack-allocated-memory #18309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
14cef6a
fabaceb
e067ac9
7abe700
3193fe8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +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 returned expression. |
| 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 | ||||||||||
|
||||||||||
| return &x; // GOOD: Don't know what &x means | |
| return &x; // BAD [FALSE NEGATIVE]: &x is an error |
vs.
| return &x; // GOOD: Don't know what &x means | |
| return &x; // BAD [FALSE NEGATIVE] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just // BAD [FALSE NEGATIVE] is sufficient in both cases, I think.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
Uh oh!
There was an error while loading. Please reload this page.