Fix range checks

This commit is contained in:
Duckbill 2018-01-13 16:02:54 +03:00
parent 3e67e64faa
commit 1de27c54f1

View File

@ -120,11 +120,11 @@ char failureReason[64];
static bool Cheat_IsValidAddress(u32 address, u32 size)
{
if (codeStartAddress <= address && address <= codeStartAddress + codeTotalSize - size)
if (codeStartAddress > 0 && codeStartAddress <= address && address <= codeStartAddress + codeTotalSize - size)
{
return true;
}
if (heapStartAddress <= address && address <= heapStartAddress + heapTotalSize - size)
if (heapStartAddress > 0 && heapStartAddress <= address && address <= heapStartAddress + heapTotalSize - size)
{
return true;
}