iR5900: fix heap-buffer-overflow in recompileNextInstruction

This commit is contained in:
oltolm 2024-08-07 00:33:20 +02:00 committed by Ty
parent 2151ffcb6a
commit c7a53703b1
1 changed files with 1 additions and 1 deletions

View File

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