Skip to content

Commit

Permalink
Fix stale heap read in UnmapMemoryImpl (shadps4-emu#2232)
Browse files Browse the repository at this point in the history
  • Loading branch information
hspir404 authored Jan 24, 2025
1 parent 3615324 commit 7072dfc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/core/memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,9 @@ u64 MemoryManager::UnmapBytesFromEntry(VAddr virtual_addr, VirtualMemoryArea vma
vma.phys_base = 0;
vma.disallow_merge = false;
vma.name = "";
MergeAdjacent(vma_map, new_it);
bool readonly_file = vma.prot == MemoryProt::CpuRead && type == VMAType::File;
const auto post_merge_it = MergeAdjacent(vma_map, new_it);
auto& post_merge_vma = post_merge_it->second;
bool readonly_file = post_merge_vma.prot == MemoryProt::CpuRead && type == VMAType::File;
if (type != VMAType::Reserved && type != VMAType::PoolReserved) {
// Unmap the memory region.
impl.Unmap(vma_base_addr, vma_base_size, start_in_vma, start_in_vma + adjusted_size,
Expand Down

0 comments on commit 7072dfc

Please sign in to comment.