From 509e24f96695f8f8d04de072de9a26b22185996d Mon Sep 17 00:00:00 2001 From: Ty Lamontagne Date: Tue, 17 Aug 2021 19:37:24 -0400 Subject: [PATCH] IOPBios: Fix OOB read when IRQ line is invalid. Fixes a PS2AutoTest where RegisterIntrHandler(-1,... ) crashes PCSX2. --- pcsx2/IopBios.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pcsx2/IopBios.cpp b/pcsx2/IopBios.cpp index d548bdff13..fd7fb95563 100644 --- a/pcsx2/IopBios.cpp +++ b/pcsx2/IopBios.cpp @@ -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