[PATCH] D71433: [analyzer] CERT: POS34-C

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Dec 14 18:43:11 PST 2019


NoQ added a comment.

In D71433#1784920 <https://reviews.llvm.org/D71433#1784920>, @zukatsinadze wrote:

> @NoQ I like the idea, but I am not really sure how to do that. I started working on Static Analyzer just lask week.


Let's get the initial attempt right first, and delay this for the next patch. You could accomplish this by keeping track of the last `putenv()` in a program state trait and moving the warning in `checkEndFunction()`.



================
Comment at: clang/test/Analysis/cert/pos34-c-fp-suppression.cpp:15
+int volatile_memory1(char *a) {
+  return putenv(a);
+  // expected-warning at -1 {{'putenv' function should not be called with auto variables}}
----------------
zukatsinadze wrote:
> I need `isPossiblyAutoVar` for this type. 
This test is pretty questionable. There is no indication in the code that `a` points to an automatic variable.


================
Comment at: clang/test/Analysis/cert/pos34-c-fp-suppression.cpp:20
+void volatile_memory2(char *a) {
+  char *buff = (char *)"hello";
+  putenv(buff);
----------------
zukatsinadze wrote:
> And `GlobalInternalSpaceRegion` for this.
This test is wrong. `"hello"` is not an automatic variable.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71433/new/

https://reviews.llvm.org/D71433





More information about the cfe-commits mailing list