Cherrypick a PartitionAlloc fix. This applies https://crrev.com/602042 to fix cookie tracking for large no-op reallocs. BUG=chromium:897585 Change-Id: I79114f26bee5a2691195649447197564419347f8 Reviewed-on: https://pdfium-review.googlesource.com/c/48911 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/third_party/base/allocator/partition_allocator/partition_alloc.cc b/third_party/base/allocator/partition_allocator/partition_alloc.cc index d0d58df..87a51fd 100644 --- a/third_party/base/allocator/partition_allocator/partition_alloc.cc +++ b/third_party/base/allocator/partition_allocator/partition_alloc.cc
@@ -209,12 +209,10 @@ // bucket->slot_size is the current size of the allocation. size_t current_size = page->bucket->slot_size; - if (new_size == current_size) - return true; - char* char_ptr = static_cast<char*>(internal::PartitionPage::ToPointer(page)); - - if (new_size < current_size) { + if (new_size == current_size) { + // No need to move any memory around, but update size and cookie below. + } else if (new_size < current_size) { size_t map_size = internal::PartitionDirectMapExtent::FromPage(page)->map_size;