You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
chromium/SOURCES/memory-allocator-dcheck-ass...

23 lines
965 B

--- a/base/allocator/partition_allocator/src/partition_alloc/partition_bucket.cc
+++ b/base/allocator/partition_allocator/src/partition_alloc/partition_bucket.cc
@@ -506,6 +506,9 @@
partition_page_count <= kMaxPartitionPagesPerRegularSlotSpan;
partition_page_count++) {
size_t candidate_size = partition_page_count * PartitionPageSize();
+ if (candidate_size > kMaxBucketed) {
+ break;
+ }
size_t waste = candidate_size % slot_size;
if (waste <= .02 * SystemPageSize()) {
return partition_page_count * NumSystemPagesPerPartitionPage();
@@ -522,6 +525,9 @@
size_t system_page_count =
partition_page_count * NumSystemPagesPerPartitionPage() - slack;
size_t candidate_size = system_page_count * SystemPageSize();
+ if (candidate_size > kMaxBucketed) {
+ break;
+ }
size_t waste = candidate_size % slot_size;
if (waste < best_waste) {
best_waste = waste;