Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem description
hex::type::Instructioncurrently fails for most inputs on master. There are two separate problems:Since 4749cc4, every syntax other than "default" throws
Invalid disassembler syntax name. The newiffor "default" starts a second if/else chain, so "intel" sets the syntax, then fails the "default" check and ends up in the trailingelse. This also breaksInstructionIntel,InstructionATNT,InstructionMASMandInstructionMotorola.A settings string without options, like "x86_64" or "aarch64", throws
Unknown disassembler option ''.splitString("", ",")returns one empty string andstringToSettings()treats it as an option name. This includes the type string the disassembler view shows, e.g.hex::type::Instruction<"x86_64", "default", 0x00, 0x00>.The second one only shows up when building against Capstone 6. With Capstone 5, fewer entries are compiled into the fixed size
Optionsarray, so the leftover slots are{ "", 0 }and the empty option happens to match one of them. That is why it works on the Windows nightly (MSYS2 Capstone 5.0.9) but not on the Linux AppImage (bundled Capstone 6).Repro, with
55 48 89 E5 31 C0 5D C3as input:Unknown disassembler option ''Invalid disassembler syntax name 'intel'push rbpImplementation description
iffor "default" toelse ifso it is part of the same chain.stringToSettings(). This also covers "x86_64;" and trailing commas.Screenshots
Not applicable, no visual change.
Additional things
I built master (f2d432d) and this branch on Linux, once with the bundled Capstone 6 and once with system Capstone 5.0.9, and ran a set of patterns through
imhex --pl format.Before: on Capstone 6 the only working case was "default" with an explicit option. On Capstone 5 only "default" worked.
After, on both: "default", "intel", "at&t", "masm", the aliases, "x86_64", "x86_64;" and "aarch64" all disassemble correctly ("at&t" gives
pushq %rbp). An invalid syntax or option name still errors like before.