mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
MMU/PatchEngine: Fix potential crash during stack probe
TryReadInstruction doesn't validate the address it resolves, that can result in Memory::GetPointer failing and returning nullptr which then leads to a nullptr dereference and a crash. Created PowerPC::HostIsInstructionRAMAddress which works the same way as PowerPC::HostIsRAMAddress for the IBAT.
This commit is contained in:
@ -223,11 +223,7 @@ static bool IsStackSane()
|
||||
return false;
|
||||
|
||||
// Check the link register makes sense (that it points to a valid IBAT address)
|
||||
auto insn = PowerPC::TryReadInstruction(PowerPC::HostRead_U32(next_SP + 4));
|
||||
if (!insn.valid || !insn.hex)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return PowerPC::HostIsInstructionRAMAddress(PowerPC::HostRead_U32(next_SP + 4));
|
||||
}
|
||||
|
||||
bool ApplyFramePatches()
|
||||
|
Reference in New Issue
Block a user