diff --git a/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/lib/Transforms/Instrumentation/AddressSanitizer.cpp index 4105dd89d85..67aef34a54b 100644 --- a/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ b/lib/Transforms/Instrumentation/AddressSanitizer.cpp @@ -2237,8 +2237,10 @@ void FunctionStackPoisoner::poisonStack() { IRBuilder<> IRBPoison(ThenTerm); if (StackMallocIdx <= 4) { int ClassSize = kMinStackMallocSize << StackMallocIdx; - ShadowBytesAfterReturn.resize(ClassSize >> Mapping.Scale, - kAsanStackUseAfterReturnMagic); + if ((int)ShadowBytesAfterReturn.size() != ClassSize) { + ShadowBytesAfterReturn.resize(ClassSize, + kAsanStackUseAfterReturnMagic); + } poisonRedZones(ShadowBytesAfterReturn, IRBPoison, ShadowBase, true); Value *SavedFlagPtrPtr = IRBPoison.CreateAdd( FakeStack, diff --git a/test/Instrumentation/AddressSanitizer/stack-poisoning.ll b/test/Instrumentation/AddressSanitizer/stack-poisoning.ll index b84a9e74f54..a3c852ad04e 100644 --- a/test/Instrumentation/AddressSanitizer/stack-poisoning.ll +++ b/test/Instrumentation/AddressSanitizer/stack-poisoning.ll @@ -44,7 +44,6 @@ entry: ; CHECK-UAR: store i64 -723401728380766731 ; CHECK-UAR: store i64 -723401728380766731 ; CHECK-UAR: store i64 -723401728380766731 - ; CHECK-UAR-NOT: store i64 ; CHECK-UAR: store i8 0 ; CHECK-UAR-NOT: store ; CHECK-UAR: label