Merge pull request #120 from Rozelette/master

memory: Return false for large VAddr in IsValidVirtualAddress
This commit is contained in:
bunnei 2018-01-20 17:37:55 -05:00 committed by GitHub
commit 6cccbf0eb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -219,6 +219,9 @@ void Write(const VAddr vaddr, const T data) {
bool IsValidVirtualAddress(const Kernel::Process& process, const VAddr vaddr) { bool IsValidVirtualAddress(const Kernel::Process& process, const VAddr vaddr) {
auto& page_table = process.vm_manager.page_table; auto& page_table = process.vm_manager.page_table;
if ((vaddr >> PAGE_BITS) >= PAGE_TABLE_NUM_ENTRIES)
return false;
const u8* page_pointer = page_table.pointers[vaddr >> PAGE_BITS]; const u8* page_pointer = page_table.pointers[vaddr >> PAGE_BITS];
if (page_pointer) if (page_pointer)
return true; return true;