Skip to content

Commit

Permalink
Fix #2244: The offset for pseudo-instr. IDs was incorrectly applied f…
Browse files Browse the repository at this point in the history
…or vcmp.
  • Loading branch information
Rot127 committed Apr 23, 2024
1 parent c4d0993 commit 6529951
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,7 @@ size_t CAPSTONE_API cs_disasm(csh ud, const uint8_t *buffer, size_t size, uint64
fill_insn(handle, insn_cache, ss.buffer, &mci, handle->post_printer, buffer);

// adjust for pseudo opcode (X86)
if (handle->arch == CS_ARCH_X86)
if (handle->arch == CS_ARCH_X86 && insn_cache->id != X86_INS_VCMP)
insn_cache->id += mci.popcode_adjust;

next_offset = insn_size;
Expand Down
4 changes: 4 additions & 0 deletions suite/cstest/issues.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1066,3 +1066,7 @@
!# issue 2233 ARM write to PC is branch
!# CS_ARCH_ARM, CS_MODE_THUMB, CS_OPT_DETAIL
0x87,0x46 == mov pc, r0 ; Groups: IsThumb jump

!# issue 2244
!# CS_ARCH_X86, CS_MODE_64, CS_OPT_DETAIL
0x0: 0xc5,0xfb,0xc2,0xda,0x06 == vcmpnlesd xmm3, xmm0, xmm2 ; ID: 797
1 change: 1 addition & 0 deletions suite/cstest/src/x86_detail.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ char *get_detail_x86(csh *ud, cs_mode mode, cs_insn *ins)

x86 = &(ins->detail->x86);

add_str(&result, " ; ID: %" PRIu32 , ins->id);
print_string_hex(&result, " ; Prefix:", x86->prefix, 4);
print_string_hex(&result, " ; Opcode:", x86->opcode, 4);
add_str(&result, " ; rex: 0x%x", x86->rex);
Expand Down

0 comments on commit 6529951

Please sign in to comment.