keystone
keystone copied to clipboard
Invalid default radix value
hello,
This is related to the merged MR 382 (Sets a default radix)
You set it to 16 but I think the default radix should be 10, else, why set it to 16 again if KS_OPT_SYNTAX_RADIX16 ?
Moreover, since this commit, I have this bad behaviour :
➜ kstool x32nasm "push 10"
push 10 = [ 6a 10 ]
When I set the default radix to 10 :
➜ kstool x32nasm "push 10"
push 10 = [ 6a 0a ]
You can also verify results with this python code :
import keystone
ks10 = keystone.Ks(keystone.KS_ARCH_X86, keystone.KS_MODE_32)
ks10.syntax = keystone.KS_OPT_SYNTAX_NASM
print(' '.join('{:02x}'.format(x) for x in ks10.asm('push 10')[0]))
ks16 = keystone.Ks(keystone.KS_ARCH_X86, keystone.KS_MODE_32)
ks16.syntax = keystone.KS_OPT_SYNTAX_NASM | keystone.KS_OPT_SYNTAX_RADIX16
print(' '.join('{:02x}'.format(x) for x in ks16.asm('push 10')[0]))
I agree that the default radix value should be 10. Otherwise there is no way to switch to radix 10 as it is right now.