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.
7.51k
stars
1.54k
forks
source link
Sparc incorrect Code Condition due to an unintended trimming #2419
Closed
david942j closed 1 month ago
Work environment
git clone
Instruction bytes giving faulty results
Basically all "jump" with conditions have wrong results on the "cc" field. Below is just one example
Expected results
It should be:
Code condition should be
SPARC_ICC_NE = 265
Steps to get the wrong result
With
cstool
:I have root caused this issue and the bug was introduced by this PR: https://github.com/capstone-engine/capstone/pull/2075
It always removes the last byte in the instruction, hence, for example, 'bne' would be considered as 'bn' when setting the
cc
field.This bug exists on both
v5
andnext
branches. I am sending pull requests.