diff options
author | bunnei <bunneidev@gmail.com> | 2021-10-04 20:08:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-04 20:08:35 +0200 |
commit | 1d829150eea666f04a61b0f21bd2fc1c2213cb6a (patch) | |
tree | 90394f001cf41957f2a8de475de902a53fb5340f /src | |
parent | Merge pull request #7091 from vonchenplus/fix_memroy_leak (diff) | |
parent | prevent access violation from iob in Memory::IsValidVirtualAddress (diff) | |
download | yuzu-1d829150eea666f04a61b0f21bd2fc1c2213cb6a.tar yuzu-1d829150eea666f04a61b0f21bd2fc1c2213cb6a.tar.gz yuzu-1d829150eea666f04a61b0f21bd2fc1c2213cb6a.tar.bz2 yuzu-1d829150eea666f04a61b0f21bd2fc1c2213cb6a.tar.lz yuzu-1d829150eea666f04a61b0f21bd2fc1c2213cb6a.tar.xz yuzu-1d829150eea666f04a61b0f21bd2fc1c2213cb6a.tar.zst yuzu-1d829150eea666f04a61b0f21bd2fc1c2213cb6a.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/memory.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 51c4dea26..88d6ec908 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -587,7 +587,11 @@ void Memory::UnmapRegion(Common::PageTable& page_table, VAddr base, u64 size) { bool Memory::IsValidVirtualAddress(const VAddr vaddr) const { const Kernel::KProcess& process = *system.CurrentProcess(); 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; } |