keystone icon indicating copy to clipboard operation
keystone copied to clipboard

Invalid default radix value

Open Summus-31c04089c3cd80 opened this issue 6 years ago • 1 comments

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]))

Summus-31c04089c3cd80 avatar Oct 16 '19 10:10 Summus-31c04089c3cd80

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.

ltfish avatar Jun 22 '20 00:06 ltfish