[PATCH] D21509: [asan] fix false dynamic-stack-buffer-overflow report with constantly-sized dynamic allocas

Anna Zaks via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 20 14:54:03 PDT 2016


zaks.anna added inline comments.

================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:468
@@ -461,2 +467,3 @@
   // Check if we have dynamic alloca.
   bool isDynamicAlloca(AllocaInst &AI) const {
+    return !AI.isStaticAlloca();
----------------
zaks.anna wrote:
> You probably can get rid of the helper function now.
I was trying to figure out why we have the check for AI.isArrayAllocation() here and I cannot.. Looks like it was added here:

 http://reviews.llvm.org/D6055

================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:906
@@ -899,2 +905,3 @@
   bool IsInteresting =
+      isDynamicAlloca(AI) ||
       (AI.getAllocatedType()->isSized() &&
----------------
kubabrecka wrote:
> zaks.anna wrote:
> > Why is this needed?
> The change above makes `getAllocaSizeInBytes` valid only for static allocas (otherwise it asserts).  This avoids calling getAllocaSizeInBytes for dynamic allocas.
Ok, Maybe we could get rid of the helper and place this check next to the getAllocaSizeInBytes to make it clear why we call this.


http://reviews.llvm.org/D21509





More information about the llvm-commits mailing list