Some instructions interpret immediates as signed while the others interpret them as unsigned. However, the imm member of cs_arm_op is typed as signed, which causes two problems:
PC-relative addresses overflow when storing if the address is more than INT32_MAX as they are computed as unsigned.
The code reading the imm member of cs_arm_op may incorrectly think it is signed when it should be treated as unsigned.
It will be nice if we can change how to store and load immediate values in cs_arm_op depending on instructions.
This issue was found during the discussion at: https://github.com/capstone-engine/capstone/pull/771#issuecomment-1594586622
Some instructions interpret immediates as signed while the others interpret them as unsigned. However, the
imm
member ofcs_arm_op
is typed as signed, which causes two problems:INT32_MAX
as they are computed as unsigned.imm
member ofcs_arm_op
may incorrectly think it is signed when it should be treated as unsigned.It will be nice if we can change how to store and load immediate values in
cs_arm_op
depending on instructions.