From 930abb4b5e57062c6dc4ce5b380f198e799c0f84 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 21 Oct 2018 22:00:06 -0400 Subject: [PATCH] svc: Correct vma_map boundary check within QueryProcessMemory This should be using the process instance retrieved within the function, and not g_current_process, otherwise this is potentially comparing iterators from unrelated vma_map instances (which is undefined behavior). --- src/core/hle/kernel/svc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 3e292bd3b..c2eeb786f 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp @@ -923,7 +923,7 @@ static ResultCode QueryProcessMemory(MemoryInfo* memory_info, PageInfo* page_inf auto vma = process->vm_manager.FindVMA(addr); - if (vma == g_current_process->vm_manager.vma_map.end()) + if (vma == process->vm_manager.vma_map.end()) return ERR_INVALID_ADDRESS; memory_info->base_address = vma->second.base;