copr-andersrh/chromium-lts/memory-allocator-dcheck-assert-fix.patch
Anders da Silva Rytter Hansen 404c44c8fa Chromium 138.0.7204.183
2026-02-12 13:20:17 -03:00

24 lines
1.3 KiB
Diff

Index: chromium-127.0.6533.88/base/allocator/partition_allocator/src/partition_alloc/partition_bucket.cc
===================================================================
--- chromium-127.0.6533.88.orig/base/allocator/partition_allocator/src/partition_alloc/partition_bucket.cc
+++ chromium-127.0.6533.88/base/allocator/partition_allocator/src/partition_alloc/partition_bucket.cc
@@ -492,6 +492,9 @@ uint8_t ComputeSystemPagesPerSlotSpanPre
partition_page_count <= kMaxPartitionPagesPerRegularSlotSpan;
partition_page_count++) {
size_t candidate_size = partition_page_count * PartitionPageSize();
+ if (candidate_size > BucketIndexLookup::kMaxBucketSize) {
+ break;
+ }
size_t waste = candidate_size % slot_size;
if (waste <= .02 * SystemPageSize()) {
return partition_page_count * NumSystemPagesPerPartitionPage();
@@ -508,6 +511,9 @@ uint8_t ComputeSystemPagesPerSlotSpanPre
size_t system_page_count =
partition_page_count * NumSystemPagesPerPartitionPage() - slack;
size_t candidate_size = system_page_count * SystemPageSize();
+ if (candidate_size > BucketIndexLookup::kMaxBucketSize) {
+ continue;
+ }
size_t waste = candidate_size % slot_size;
if (waste < best_waste) {
best_waste = waste;