[PATCH] D31868: [analyzer] Check NULL pointer dereference issue for memset function

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 1 04:34:53 PDT 2017


NoQ added a comment.

The code looks good now! A few minor comments and we can commit this :)



================
Comment at: lib/StaticAnalyzer/Checkers/CStringChecker.cpp:2010
+  const Expr *Mem = CE->getArg(0);
+  const Expr *Const = CE->getArg(1);
+  const Expr *Size = CE->getArg(2);
----------------
This variable is unused. It might make buildbots angry.


================
Comment at: test/Analysis/null-deref-ps-region.c:25
+  memset(x, 0, sizeof(int));
+  int n = 1 / *x;
+  free(x);
----------------
Could you mark this as FIXME? Eg:
```
int n = 1 / *x; // FIXME: no-warning
```
Because eventually it should warn.


================
Comment at: test/Analysis/null-deref-ps-region.c:36
+
+void f531() {
+  int *x = 0;
----------------
Can we make function names more fancy?

Eg. "testConcreteNull", "testStackArray", "testHeapSymbol", etc.


Repository:
  rL LLVM

https://reviews.llvm.org/D31868





More information about the cfe-commits mailing list