From c7a53703b15661b004dc6648bcd6d50657a0abef Mon Sep 17 00:00:00 2001 From: oltolm Date: Wed, 7 Aug 2024 00:33:20 +0200 Subject: [PATCH] iR5900: fix heap-buffer-overflow in recompileNextInstruction --- pcsx2/x86/ix86-32/iR5900.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pcsx2/x86/ix86-32/iR5900.cpp b/pcsx2/x86/ix86-32/iR5900.cpp index 75231334f3..c08bb247de 100644 --- a/pcsx2/x86/ix86-32/iR5900.cpp +++ b/pcsx2/x86/ix86-32/iR5900.cpp @@ -1707,7 +1707,7 @@ void recompileNextInstruction(bool delayslot, bool swapped_delay_slot) g_pCurInstInfo++; // pc might be past s_nEndBlock if the last instruction in the block is a DI. - if (pc <= s_nEndBlock) + if (pc <= s_nEndBlock && (g_pCurInstInfo + (s_nEndBlock - pc) / 4 + 1) <= s_pInstCache + s_nInstCacheSize) { int count; for (u32 i = 0; i < iREGCNT_GPR; ++i)