capstone-engine / capstone

Capstone disassembly/disassembler framework for ARM, ARM64 (ARMv8), Alpha, BPF, Ethereum VM, HPPA, LoongArch, M68K, M680X, Mips, MOS65XX, PPC, RISC-V(rv32G/rv64G), SH, Sparc, SystemZ, TMS320C64X, TriCore, Webassembly, XCore and X86.
http://www.capstone-engine.org
7.51k stars 1.54k forks source link

movsxd not disassembed correctly in capstone5 #2442

Open jordan9001 opened 1 month ago

jordan9001 commented 1 month ago

Work environment

Questions Answers
OS/arch/bits Linux x86_64 build
Architecture x86_64
Source of Capstone Both 5.0.2 release, and latest from next branch
Version/git commit v5.0.2, 5e6807bab9ba6a8112b8ba1f92285924e699ee84

Instruction bytes giving faulty results

0x41,0x63,0xd2
0x63,0x6b,0x20,0x55,0x48,0x8b,0x05,0xb8,0x13,0x00,0x00

Expected results

It should be:

4163d2             movsxd  edx, r10d

The other set is another variation of movsd.

Steps to get the wrong result

With cstool:

$ ./cstool -d x64 "0x63 0x6b 0x20 0x55 0x48 0x8b 0x05 0xb8 0x13 0x00 0x00"
ERROR: invalid assembly code
$ ./cstool -d x64 "0x41 0x63 0xd2"
ERROR: invalid assembly code

Additional Logs, screenshots, source code, configuration dump, ...

See the previous issue: https://github.com/capstone-engine/capstone/issues/1093