summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-10-04 20:08:35 +0200
committerGitHub <noreply@github.com>2021-10-04 20:08:35 +0200
commit1d829150eea666f04a61b0f21bd2fc1c2213cb6a (patch)
tree90394f001cf41957f2a8de475de902a53fb5340f /src/core
parentMerge pull request #7091 from vonchenplus/fix_memroy_leak (diff)
parentprevent access violation from iob in Memory::IsValidVirtualAddress (diff)
downloadyuzu-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 'src/core')
-rw-r--r--src/core/memory.cpp6
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;
}