Skip to content

Commit

Permalink
Fix reachable Capstone assert. (#4571)
Browse files Browse the repository at this point in the history
ESIL requested a register name with a non-register value.
  • Loading branch information
Rot127 authored Jul 16, 2024
1 parent d004e84 commit e878181
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions librz/arch/isa/arm/arm_esil32.c
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,10 @@ r6,r5,r4,3,sp,[*],12,sp,+=
// TODO: esil for MRS
break;
case ARM_INS_MSR:
if (insn->detail->arm.operands[0].type != ARM_OP_REG) {
// New sysop operands added in Capstone v6 are not supported in ESIL.
break;
}
#if CS_NEXT_VERSION >= 6
msr_flags = insn->detail->arm.operands[0].sysop.msr_mask;
#else
Expand Down
16 changes: 16 additions & 0 deletions test/db/esil/arm_32
Original file line number Diff line number Diff line change
Expand Up @@ -2970,3 +2970,19 @@ d0 = 0x01c00df0fecadec0
d1 = 0xaaaaaaaaaaaaaaaa
EOF
RUN

NAME=reachable capstone assert
FILE=malloc://0x100
CMDS=<<EOF
e esil.verbose=2
e asm.arch=arm
e asm.bits=32
wx fbfd21b3 # msrlt cpsr_c, #0x3ec0
pi 1
pie 1
EOF
EXPECT=<<EOF
msrlt cpsr_c, 0x3ec0
0x00000000 nf,vf,^,?{,,}
EOF
RUN

0 comments on commit e878181

Please sign in to comment.