IOPBios: Fix OOB read when IRQ line is invalid.

Fixes a PS2AutoTest where RegisterIntrHandler(-1,... ) crashes PCSX2.
This commit is contained in:
Ty Lamontagne 2021-08-17 19:37:24 -04:00 committed by refractionpcsx2
parent d0f3c620d2
commit 509e24f966
1 changed files with 8 additions and 1 deletions

View File

@ -863,7 +863,14 @@ namespace R3000A
void RegisterIntrHandler_DEBUG()
{
DevCon.WriteLn(Color_Gray, "RegisterIntrHandler: intr %s, handler %x", intrname[a0], a2);
if(a0 < std::size(intrname) - 1)
{
DevCon.WriteLn(Color_Gray, "RegisterIntrHandler: intr %s, handler %x", intrname[a0], a2);
}
else
{
DevCon.WriteLn(Color_Gray, "RegisterIntrHandler: intr UNKNOWN (%d), handler %x",a0,a2);
}
}
} // namespace intrman