Skip to content

Commit

Permalink
Fix Result_Type for immediate operands
Browse files Browse the repository at this point in the history
  • Loading branch information
mxz297 committed Sep 16, 2019
1 parent c170c8c commit 48de92d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions instructionAPI/src/InstructionDecoder-Capstone.C
Original file line number Diff line number Diff line change
Expand Up @@ -1744,7 +1744,7 @@ void InstructionDecoder_Capstone::decodeOperands_x86(const Instruction* insn, cs
}
//TODO: correctly mark implicit registers
} else if (operand->type == X86_OP_IMM) {
Expression::Ptr immAST = Immediate::makeImmediate(Result(s64, operand->imm));
Expression::Ptr immAST = Immediate::makeImmediate(Result(s32, operand->imm));
if (isCFT) {
// It looks like that Capstone automatically adjust the offset with the instruction length
Expression::Ptr IP(makeRegisterExpression(MachRegister::getPC(m_Arch)));
Expand Down Expand Up @@ -1776,7 +1776,8 @@ void InstructionDecoder_Capstone::decodeOperands_x86(const Instruction* insn, cs
else
effectiveAddr = indexAST;
}
Expression::Ptr immAST = Immediate::makeImmediate(Result(s64, mem->disp));
// Displacement for addressing memory. So it is unsigned
Expression::Ptr immAST = Immediate::makeImmediate(Result(u32, mem->disp));
if (effectiveAddr)
effectiveAddr = makeAddExpression(effectiveAddr, immAST , u64);
else
Expand Down

0 comments on commit 48de92d

Please sign in to comment.