Fix undefined shifts (#1158)

Use multiply instead
Found by oss-fuzz
This commit is contained in:
Catena cyber 2018-06-02 10:52:52 +02:00 committed by Nguyen Anh Quynh
parent de55611538
commit fbb90bcb35
2 changed files with 2 additions and 2 deletions

View File

@ -1248,7 +1248,7 @@ static void printAlignedLabel(MCInst *MI, unsigned OpNum, SStream *O)
// If the label has already been resolved to an immediate offset (say, when
// we're running the disassembler), just print the immediate.
if (MCOperand_isImm(Op)) {
uint64_t imm = (MCOperand_getImm(Op) << 2) + MI->address;
uint64_t imm = (MCOperand_getImm(Op) * 4) + MI->address;
printUInt64Bang(O, imm);
if (MI->csh->detail) {
MI->flat_insn->detail->arm64.operands[MI->flat_insn->detail->arm64.op_count].type = ARM64_OP_IMM;

View File

@ -533,7 +533,7 @@ static void printAbsBranchOperand(MCInst *MI, unsigned OpNo, SStream *O)
return;
}
imm = ((int)MCOperand_getImm(MCInst_getOperand(MI, OpNo)) << 2);
imm = ((int)MCOperand_getImm(MCInst_getOperand(MI, OpNo)) * 4);
if (!PPC_abs_branch(MI->csh, MCInst_getOpcode(MI))) {
imm = (int)MI->address + imm;