File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -427,25 +427,24 @@ optional<Block *> Block::split(size_t new_inner_size,
427
427
size_t usable_space_alignment) {
428
428
LIBC_ASSERT (usable_space_alignment % alignof (max_align_t ) == 0 &&
429
429
" alignment must be a multiple of max_align_t" );
430
-
431
430
if (used ())
432
431
return {};
433
432
434
- size_t old_outer_size = outer_size ();
435
-
436
433
// Compute the minimum outer size that produces a block of at least
437
434
// `new_inner_size`.
438
435
size_t min_outer_size = outer_size (cpp::max (new_inner_size, sizeof (prev_)));
439
436
440
437
uintptr_t start = reinterpret_cast <uintptr_t >(this );
441
438
uintptr_t next_block_start =
442
439
next_possible_block_start (start + min_outer_size, usable_space_alignment);
440
+ if (next_block_start < start)
441
+ return {};
443
442
size_t new_outer_size = next_block_start - start;
444
443
LIBC_ASSERT (new_outer_size % alignof (max_align_t ) == 0 &&
445
444
" new size must be aligned to max_align_t" );
446
445
447
- if (old_outer_size < new_outer_size ||
448
- old_outer_size - new_outer_size < sizeof (Block))
446
+ if (outer_size () < new_outer_size ||
447
+ outer_size () - new_outer_size < sizeof (Block))
449
448
return {};
450
449
451
450
ByteSpan new_region = region ().subspan (new_outer_size);
You can’t perform that action at this time.
0 commit comments