forked from OSchip/llvm-project
[scudo] Untag BlockEnd in reallocate
If we get here from reallocate, BlockEnd is tagged. Then we will storeTag(UntaggedEnd) into the header of the next chunk. Luckily header tag is 0 so unpatched code still works. Reviewed By: pcc Differential Revision: https://reviews.llvm.org/D105261
This commit is contained in:
parent
e386871e1d
commit
fe30963600
|
@ -639,7 +639,7 @@ public:
|
|||
if (ClassId) {
|
||||
resizeTaggedChunk(reinterpret_cast<uptr>(OldTaggedPtr) + OldSize,
|
||||
reinterpret_cast<uptr>(OldTaggedPtr) + NewSize,
|
||||
NewSize, BlockEnd);
|
||||
NewSize, untagPointer(BlockEnd));
|
||||
storePrimaryAllocationStackMaybe(Options, OldPtr);
|
||||
} else {
|
||||
storeSecondaryAllocationStackMaybe(Options, OldPtr, NewSize);
|
||||
|
@ -1154,6 +1154,7 @@ private:
|
|||
// 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) {
|
||||
DCHECK_EQ(BlockEnd, untagPointer(BlockEnd));
|
||||
uptr UntaggedEnd = untagPointer(End);
|
||||
if (UntaggedEnd != BlockEnd) {
|
||||
storeTag(UntaggedEnd);
|
||||
|
|
Loading…
Reference in New Issue