diff --git a/compiler-rt/lib/scudo/standalone/combined.h b/compiler-rt/lib/scudo/standalone/combined.h --- a/compiler-rt/lib/scudo/standalone/combined.h +++ b/compiler-rt/lib/scudo/standalone/combined.h @@ -639,7 +639,7 @@ if (ClassId) { resizeTaggedChunk(reinterpret_cast(OldTaggedPtr) + OldSize, reinterpret_cast(OldTaggedPtr) + NewSize, - NewSize, BlockEnd); + NewSize, untagPointer(BlockEnd)); storePrimaryAllocationStackMaybe(Options, OldPtr); } else { storeSecondaryAllocationStackMaybe(Options, OldPtr, NewSize); @@ -1153,9 +1153,10 @@ // memory tag space, which getInlineErrorInfo() normally relies on to match // address tags against chunks. To allow matching in this case we store the // address tag in the first byte of the chunk. - void storeEndMarker(uptr End, uptr Size, uptr BlockEnd) { + void storeEndMarker(uptr End, uptr Size, uptr UntaggedBlockEnd) { + DCHECK_EQ(UntaggedBlockEnd, untagPointer(UntaggedBlockEnd)); uptr UntaggedEnd = untagPointer(End); - if (UntaggedEnd != BlockEnd) { + if (UntaggedEnd != UntaggedBlockEnd) { storeTag(UntaggedEnd); if (Size == 0) *reinterpret_cast(UntaggedEnd) = extractTag(End);