Skip to content
Snippets Groups Projects
Commit c038638e authored by Jason Hiser's avatar Jason Hiser :tractor:
Browse files

minor fixes for instructions that are likely bogus (i.e., pcrel insns that...

minor fixes for instructions that are likely bogus (i.e., pcrel insns that access out-of-bounds memory)
parent 64fee958
No related branches found
No related tags found
No related merge requests found
Pipeline #3376 passed
......@@ -844,7 +844,9 @@ class FixCalls_t : public TransformStep_t
switch(size)
{
case 4:
assert( (uintptr_t)(int)newdisp == (uintptr_t)newdisp);
// if newdisp is negative (or bigger than 32-bit), then the instruction is accessing invalid memory.
// and is likely bogus. we just skip doing any pc-rel for it.
if( (uintptr_t)(int32_t)newdisp != (uintptr_t)newdisp) continue;
*(int*)offsetptr=newdisp;
break;
case 1:
......
......@@ -70,9 +70,14 @@ bool IRDB_SDK::isParameterWrite(const IRDB_SDK::FileIR_t *firp, IRDB_SDK::Instru
if(!d.getOperand(0)->isMemory())
return false;
// pcrel instructions aren't to the stack.
if(d.getOperand(0)->isPcrel())
return false;
// check that base reg is esp.
if(!d.getOperand(0)->hasBaseRegister())
return false;
if(d.getOperand(0)->getBaseRegister() != 4)
return false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment