Handle 0xcc in anal.nopskip

This commit is contained in:
pancake 2014-12-22 23:36:21 +01:00
parent cbfee9f596
commit 9b17bd596b

View File

@ -379,6 +379,20 @@ repeat:
anal->iob.read_at (anal->iob.io, x, bbuf, sizeof (bbuf));\
ret = fcn_recurse (anal, fcn, x, bbuf, sizeof (bbuf), depth-1);
switch (op.type) {
case R_ANAL_OP_TYPE_TRAP:
if (anal->nopskip && buf[0]==0xcc) {
if ((addr + delay.un_idx-oplen) == fcn->addr) {
fcn->addr += oplen;
bb->size -= oplen;
bb->addr += oplen;
idx = delay.un_idx;
goto repeat;
continue;
}
}
FITFCNSZ ();
r_anal_op_fini (&op);
return R_ANAL_RET_END;
case R_ANAL_OP_TYPE_NOP:
if (anal->nopskip) {
if ((addr + delay.un_idx-oplen) == fcn->addr) {
@ -398,7 +412,7 @@ repeat:
if (continue_after_jump) {
recurseAt (op.jump);
recurseAt (op.fail);
} else {
} else {
// This code seems to break #1519
if (anal->eobjmp) {
#if JMP_IS_EOB
@ -437,7 +451,7 @@ repeat:
return R_ANAL_RET_END;
}
}
}
}
break;
case R_ANAL_OP_TYPE_CJMP:
(void) r_anal_fcn_xref_add (anal, fcn, op.addr, op.jump, R_ANAL_REF_TYPE_CODE);
@ -469,7 +483,6 @@ repeat:
case R_ANAL_OP_TYPE_UJMP:
if (continue_after_jump)
break;
case R_ANAL_OP_TYPE_TRAP:
case R_ANAL_OP_TYPE_RET:
VERBOSE_ANAL eprintf ("RET 0x%08"PFMT64x". %d %d %d\n",
addr+delay.un_idx-oplen, overlapped,