-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[clang][analyzer] Bring checker 'alpha.unix.cstring.NotNullTerminated' out of alpha #113899
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 1 commit
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 |
|---|---|---|
|
|
@@ -53,3 +53,7 @@ struct TestNotNullTerm { | |
| strlen((char *)&x); // expected-warning{{Argument to string length function is not a null-terminated string}} | ||
| } | ||
| }; | ||
|
|
||
| void test_notcstring_tempobject() { | ||
| strlen((char[]){'a', 0}); // expected-warning{{Argument to string length function is a C++ temp object of type char[2], which is not a null-terminated string}} | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To me this result looks like a false positive (I'd guess that this If this is indeed a false positive, then either fix it, or add a comment like "FIXME: In this corner case the checker produces a false positive". If the report is a true positive, then perhaps explain why is it a true positive.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is taken from a FIXME in line 991 of the checker code. This exact case is really a false positive, a warning is needed only if a write happens into such a region. For this exact case (temporary object that behaves like a C string) the checker can be improved. But such a change would affect other checkers in the 'cstring' group. |
||
Uh oh!
There was an error while loading. Please reload this page.