summaryrefslogtreecommitdiff
path: root/third_party
diff options
context:
space:
mode:
Diffstat (limited to 'third_party')
-rw-r--r--third_party/base/allocator/partition_allocator/partition_alloc.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/third_party/base/allocator/partition_allocator/partition_alloc.cc b/third_party/base/allocator/partition_allocator/partition_alloc.cc
index a33d7f1d13..ff366b861f 100644
--- a/third_party/base/allocator/partition_allocator/partition_alloc.cc
+++ b/third_party/base/allocator/partition_allocator/partition_alloc.cc
@@ -1065,8 +1065,10 @@ void* PartitionReallocGeneric(PartitionRootGeneric* root,
// after updating statistics (and cookies, if present).
PartitionPageSetRawSize(page, PartitionCookieSizeAdjustAdd(new_size));
#if DCHECK_IS_ON()
- // Write a new trailing cookie.
- PartitionCookieWriteValue(static_cast<char*>(ptr) + new_size);
+ // Write a new trailing cookie when it is possible to keep track of
+ // |new_size| via the raw size pointer.
+ if (PartitionPageGetRawSizePtr(page))
+ PartitionCookieWriteValue(static_cast<char*>(ptr) + new_size);
#endif
return ptr;
}