added more error checking around clearing code

This commit is contained in:
zilmar 2012-10-01 13:53:21 +10:00
parent 95e2b17796
commit 15894a0e6c
1 changed files with 13 additions and 2 deletions

View File

@ -897,8 +897,19 @@ void CRecompiler::ClearRecompCode_Phys(DWORD Address, int length, REMOVE_REASON
} }
else if (LookUpMode() == FuncFind_PhysicalLookup) else if (LookUpMode() == FuncFind_PhysicalLookup)
{ {
WriteTraceF(TraceRecompiler,"Reseting Jump Table, Addr: %X len: %d",Address,((length + 3) & ~3)); if (Address < RdramSize())
memset((BYTE *)JumpTable() + Address,0,((length + 3) & ~3)); {
int ClearLen = ((length + 3) & ~3);
if (Address + ClearLen > RdramSize())
{
_Notify->BreakPoint(__FILE__,__LINE__);
ClearLen = RdramSize() - Address;
}
WriteTraceF(TraceRecompiler,"Reseting Jump Table, Addr: %X len: %d",Address,ClearLen);
memset((BYTE *)JumpTable() + Address,0,ClearLen);
} else{
WriteTraceF(TraceRecompiler,"Ignoring reset of Jump Table, Addr: %X len: %d",Address,((length + 3) & ~3));
}
} }
} }