[PATCH] D54592: [analyzer][CStringChecker] evaluate explicit_bzero
Artem Dergachev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 11 10:22:27 PST 2018
NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.
Looks good, thanks!
================
Comment at: lib/StaticAnalyzer/Checkers/CStringChecker.cpp:2216
+ // In this case we just return.
+ if (StateZeroSize && !StateNonZeroSize) {
+ C.addTransition(StateZeroSize);
----------------
`!StateNonZeroSize` implies `StateZeroSize`, you can drop the left-hand side of `&&`.
================
Comment at: test/Analysis/string.c:1405-1406
+ clang_analyzer_eval(strlen(str) == 4); // expected-warning{{TRUE}}
+ bzero(str + 2, 2);
+ clang_analyzer_eval(strlen(str) == 0); // expected-warning{{FALSE}}
+}
----------------
devnexen wrote:
> NoQ wrote:
> > Let's also add the true statement. I.e., do we know here that the actual length is 2?
> I think that s the limit of this checker (even with memset that does not work).
I mean, even if it doesn't work, let's add a FIXME test.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D54592/new/
https://reviews.llvm.org/D54592
More information about the cfe-commits
mailing list