Skip to content

ARM T2 encoding lsl #imm bug #265

Closed
Closed
@pzread

Description

@pzread

Hi,
Capstone correctly outputs this T2 encoding instruction (thumb mode, detail enabled

ldr.w r3, [r2, r3, lsl #2]

But the <cs_arm_op>.mem.shift.type of the second operand = ARM_SFT_INVALID, which is wrong.

I found that in printT2AddrModeSoRegOperand at arch/ARM/ARMInstPrinter.c

line 2094:    MI->flat_insn->detail->arm.operands[MI->flat_insn->detail->arm.op_count - 1].shift.type = ARM_SFT_LSL;
line 2095:    MI->flat_insn->detail->arm.operands[MI->flat_insn->detail->arm.op_count - 1].shift.value = ShAmt;

It seems like
MI->flat_insn->detail->arm.op_count - 1 should be MI->flat_insn->detail->arm.op_count

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions