Fix jump address computation in anal_ppc_cs.c

The insn->detail->ppc.operands[0].type is a int32_t as is converted
into a uint64_t. It was sign extended during the conversion leading to
buggy addresses (0xffffffff80004020 instead of 0x80004020) if the high
bit was set.
This commit is contained in:
Gabriel Corona 2015-05-13 17:57:01 +02:00 committed by pancake
parent c9d10560b9
commit c995f0b658

View File

@ -99,16 +99,16 @@ static int analop(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int len) {
case PPC_INS_BA:
case PPC_INS_BC:
op->type = R_ANAL_OP_TYPE_JMP;
op->jump = insn->detail->ppc.operands[0].imm;
op->jump = (ut64)(ut32)insn->detail->ppc.operands[0].imm;
switch (insn->detail->ppc.operands[0].type) {
case PPC_OP_CRX:
op->type = R_ANAL_OP_TYPE_CJMP;
op->jump = insn->detail->ppc.operands[1].imm;
op->jump = (ut64)(ut32)insn->detail->ppc.operands[1].imm;
op->fail = addr+4;
break;
case PPC_OP_REG:
op->type = R_ANAL_OP_TYPE_CJMP;
op->jump = insn->detail->ppc.operands[1].imm;
op->jump = (ut64)(ut32)insn->detail->ppc.operands[1].imm;
op->fail = addr+4;
//op->type = R_ANAL_OP_TYPE_UJMP;
default: