mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:07:35 +00:00
Kernel: RangeAllocator randomized correctly check if size is in bound. (#5164)
The random address proposals were not checked with the size so it was
increasely likely to try to allocate outside of available space with
larger and larger sizes.
Now they will be ignored instead of triggering a Kernel assertion
failure.
This is a continuation of: c8e7baf4b8
This commit is contained in:
parent
51df44534b
commit
df30b3e54c
1 changed files with 1 additions and 1 deletions
|
@ -108,7 +108,7 @@ Optional<Range> RangeAllocator::allocate_randomized(size_t size, size_t alignmen
|
|||
VirtualAddress random_address { get_good_random<FlatPtr>() };
|
||||
random_address.mask(PAGE_MASK);
|
||||
|
||||
if (!m_total_range.contains(random_address))
|
||||
if (!m_total_range.contains(random_address, size))
|
||||
continue;
|
||||
|
||||
auto range = allocate_specific(random_address, size);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue