keystone icon indicating copy to clipboard operation
keystone copied to clipboard

ARM/Thumb LDR produce error code when offset out of range

Open LeadroyaL opened this issue 6 years ago • 0 comments

from keystone import *
ks = Ks(KS_ARCH_ARM, KS_MODE_THUMB)
ks.asm("LDR.W R0, $+0x12345678)
ks.asm("LDR.W R0, $+0x2345678)
ks.asm("LDR.W R0, $+0x345678)

The label of the literal data item that is to be loaded into <Rt>. The assembler calculates the required value of the offset from the Align(PC, 4) value of the instruction to this label. Permitted values of the offset are: Encoding T1 Multiples of four in the range 0 to 1020. Encoding T2 or A1 Any value in the range -4095 to 4095.

So I think keystone should add check to the range of offset.

LeadroyaL avatar Sep 29 '19 08:09 LeadroyaL