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:
EmptyChaos
2017-01-23 21:05:11 +00:00
parent bd2881ff86
commit 49873b1287
3 changed files with 20 additions and 12 deletions

View File

@ -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()