2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

Merge pull request #7107 from astrelsky/iob_fix

prevent access violation from iob in Memory::IsValidVirtualAddress
This commit is contained in:
bunnei 2021-10-04 11:08:35 -07:00 committed by GitHub
commit 1d829150ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -587,7 +587,11 @@ void Memory::UnmapRegion(Common::PageTable& page_table, VAddr base, u64 size) {
bool Memory::IsValidVirtualAddress(const VAddr vaddr) const { bool Memory::IsValidVirtualAddress(const VAddr vaddr) const {
const Kernel::KProcess& process = *system.CurrentProcess(); const Kernel::KProcess& process = *system.CurrentProcess();
const auto& page_table = process.PageTable().PageTableImpl(); const auto& page_table = process.PageTable().PageTableImpl();
const auto [pointer, type] = page_table.pointers[vaddr >> PAGE_BITS].PointerType(); const size_t page = vaddr >> PAGE_BITS;
if (page >= page_table.pointers.size()) {
return false;
}
const auto [pointer, type] = page_table.pointers[page].PointerType();
return pointer != nullptr || type == Common::PageType::RasterizerCachedMemory; return pointer != nullptr || type == Common::PageType::RasterizerCachedMemory;
} }