Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
AsmLexer.cpp#L28
The
dafaultRadix
field is set toMAI.getRadix()
, andMAI.Radix
may not be set at the timeMAI.getRadix()
is called.PR #382 attempted to fix this issue by adding
ks->MAI->setRadix(16)
toks_option()
, butks_option()
may not be called when assembling the instructions, for example, on keystone's offcial tutorialIn this case
MAI.Radix
is still not initialized, sodefaultRadix
can be any value. WhendefaultRadix
is anything other than 16, then[1-9][0-9]*
in instructions will be assembled as decimal values (AsmLexer.cpp#L262), otherwise whendefaultRadix
is 16,[1-9][0-9]*
in instructions will be assembled as hex values (AsmLexer.cpp#L264). As a result, the behavior will be unpredictable.I think the default radix should be 10 because otherwise we won't be able to assemble instructions with decimal values, If users wish to change the default radix to 16, they can use
KS_OPT_SYNTAX_RADIX16
option.AsmLexer.cpp#L265