[PATCH] D75695: [StackProtector] Catch direct out-of-bounds when checking address-takenness

John Brawn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 6 05:31:23 PST 2020


john.brawn marked an inline comment as done.
john.brawn added inline comments.


================
Comment at: llvm/lib/CodeGen/StackProtector.cpp:202
+      APInt MaxOffset(TypeSize, DL.getTypeStoreSize(
+                        AI->getType()->getPointerElementType()));
+      if (!GEP->accumulateConstantOffset(DL, Offset) || Offset.uge(MaxOffset))
----------------
efriedma wrote:
> I think AllocaInst has a getAllocatedType, or something like that?
> 
> Should use getTypeAllocSize, since that's what actually determines the number of bytes allocated.
> I think AllocaInst has a getAllocatedType, or something like that?
AI isn't necessarily an AllocaInst, e.g. we could be looking at a GEP of a GEP or a GEP of a PHI.

> Should use getTypeAllocSize, since that's what actually determines the number of bytes allocated.
Will do.



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

https://reviews.llvm.org/D75695





More information about the llvm-commits mailing list