mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-22 00:15:04 +00:00
Kernel: Assert if rounding-up-to-page-size would wrap around to 0
If we try to align a number above 0xfffff000 to the next multiple of the page size (4 KiB), it would wrap around to 0. This is most likely never what we want, so let's assert if that happens.
This commit is contained in:
@@ -42,7 +42,7 @@ inline bool KBufferBuilder::check_expand(size_t size)
|
||||
size_t new_buffer_size = m_size + size;
|
||||
if (Checked<size_t>::addition_would_overflow(new_buffer_size, 1 * MiB))
|
||||
return false;
|
||||
new_buffer_size = PAGE_ROUND_UP(new_buffer_size + 1 * MiB);
|
||||
new_buffer_size = page_round_up(new_buffer_size + 1 * MiB);
|
||||
return m_buffer->expand(new_buffer_size);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user