mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-01 03:57:15 +02:00
Kernel: Fix off-by-one in Memory::is_user_range() check
This function was checking 1 byte after the provided range, which caused it to reject valid userspace ranges that happened to end exactly at the top of the user address space. This fixes a long-standing issue with mysterious Optional errors in Coredump::write_regions(). (It happened when trying to add a memory region at the very top of the address space to a coredump.)
This commit is contained in:
Notes:
sideshowbarker
2024-07-18 04:18:36 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/890c647e0f2
@@ -302,7 +302,11 @@ inline bool is_user_range(VirtualAddress vaddr, size_t size)
|
||||
{
|
||||
if (vaddr.offset(size) < vaddr)
|
||||
return false;
|
||||
return is_user_address(vaddr) && is_user_address(vaddr.offset(size));
|
||||
if (!is_user_address(vaddr))
|
||||
return false;
|
||||
if (size <= 1)
|
||||
return true;
|
||||
return is_user_address(vaddr.offset(size - 1));
|
||||
}
|
||||
|
||||
inline bool is_user_range(VirtualRange const& range)
|
||||
|
||||
Reference in New Issue
Block a user