[PATCH] D54592: [CStringChecker] evaluate explicit_bzero
Artem Dergachev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 4 15:44:44 PST 2018
NoQ added a comment.
When you're doing something but it isn't working, i encourage you to investigate it more pro-actively, or at least add a FIXME so that people didn't think that this is the intended behavior.
================
Comment at: lib/StaticAnalyzer/Checkers/CStringChecker.cpp:2232
+
+ memsetAux(Mem, Zero, Size, C, State);
+}
----------------
This `Zero` is of the wrong type: it is `size_t` but it should be `int`. You'll need to make a new one.
================
Comment at: test/Analysis/string.c:1399
+ bzero(str, 2);
+ clang_analyzer_eval(strlen(str) == 0); // expected-warning{{UNKNOWN}}
+}
----------------
I suspect that the reason why this didn't work is that you forgot `.addTransition()`.
Could you also test that `bzero(str + 2, 2);` doesn't turn `strlen(str)` into zero?
================
Comment at: test/Analysis/string.c:1413-1414
+
+ clang_analyzer_eval(strlen(passwd) == 0); // expected-warning{{UNKNOWN}}
+ clang_analyzer_eval(passwd[0] == '\0'); // expected-warning{{UNKNOWN}}
+}
----------------
Probably same `.addTransition()` problem here.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D54592/new/
https://reviews.llvm.org/D54592
More information about the cfe-commits
mailing list