[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
Mon Mar 16 07:00:07 PDT 2020
john.brawn marked an inline comment as done.
john.brawn added inline comments.
================
Comment at: llvm/lib/CodeGen/StackProtector.cpp:209
+ unsigned TypeSize = DL.getIndexTypeSizeInBits(I->getType());
+ uint64_t ResultSize = DL.getTypeAllocSize(GEP->getResultElementType());
+ APInt Offset(TypeSize, ResultSize);
----------------
efriedma wrote:
> Can we just compute ResultSize as "AllocSize - Offset"? (That's obviously correct, and I'm not convinced that using the size of getResultElementType() does the right thing here.)
I think we can. Currently the offset check is done in a way that also checks if the end of the addressed member is past the end of the allocation, but just checking that the start is within the allocation and then reducing the remaining size by the offset will mean we check at the time we see a memory access that it's not too large for the remaining space.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75695/new/
https://reviews.llvm.org/D75695
More information about the llvm-commits
mailing list