[PATCH] D39438: [analyzer] Diagnose stack leaks via block captures

Alexander Shaposhnikov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 31 09:12:37 PDT 2017


alexshap added inline comments.


================
Comment at: lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp:144
+        return;
+      if (dyn_cast_or_null<StackSpaceRegion>(Region->getMemorySpace())) {
+        ExplodedNode *N = C.generateErrorNode();
----------------
NoQ wrote:
> `getMemorySpace()` is never null. Every region resides in a memory space.
i was looking at StackAddrEscapeChecker::checkPreStmt - should it be fixed there as well, or that one is different ?


================
Comment at: lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp:145
+      if (dyn_cast_or_null<StackSpaceRegion>(Region->getMemorySpace())) {
+        ExplodedNode *N = C.generateErrorNode();
+        if (!N)
----------------
xazax.hun wrote:
> This will stop the analysis on this execution path. Is this desired? Usually, we stop the execution when there is no way to model the program state after the error, e.g.: after a division by zero. In this case the stack address escaped but it wasn't dereferenced (yet), so I think it might be safe to continue the analysis on this path.  What do you think?
I think you are right, would be better to make it non-fatal


Repository:
  rL LLVM

https://reviews.llvm.org/D39438





More information about the cfe-commits mailing list