mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-19 13:42:00 +00:00
Avoid crashing when calling an invalid address.
We already have a check, let's use it properly.
This commit is contained in:
parent
9bcffc5b4d
commit
199e6bcd3b
@ -756,6 +756,10 @@ void GPUCommon::Execute_Call(u32 op, u32 diff) {
|
||||
// Saint Seiya needs correct support for relative calls.
|
||||
const u32 retval = currentList->pc + 4;
|
||||
const u32 target = gstate_c.getRelativeAddress(op & 0x00FFFFFC);
|
||||
if (!Memory::IsValidAddress(target)) {
|
||||
ERROR_LOG_REPORT(G3D, "CALL to illegal address %08x - ignoring! data=%06x", target, op & 0x00FFFFFF);
|
||||
return;
|
||||
}
|
||||
|
||||
// Bone matrix optimization - many games will CALL a bone matrix (!).
|
||||
if ((Memory::ReadUnchecked_U32(target) >> 24) == GE_CMD_BONEMATRIXDATA) {
|
||||
@ -770,8 +774,6 @@ void GPUCommon::Execute_Call(u32 op, u32 diff) {
|
||||
|
||||
if (currentList->stackptr == ARRAY_SIZE(currentList->stack)) {
|
||||
ERROR_LOG_REPORT(G3D, "CALL: Stack full!");
|
||||
} else if (!Memory::IsValidAddress(target)) {
|
||||
ERROR_LOG_REPORT(G3D, "CALL to illegal address %08x - ignoring! data=%06x", target, op & 0x00FFFFFF);
|
||||
} else {
|
||||
auto &stackEntry = currentList->stack[currentList->stackptr++];
|
||||
stackEntry.pc = retval;
|
||||
|
Loading…
x
Reference in New Issue
Block a user