Fix disassembler silent truncation - #14136
Open
jlb6740 wants to merge 1 commit into
Open
Conversation
jlb6740
force-pushed
the
fix-disassembler-silent-truncation
branch
2 times, most recently
from
August 20, 2026 01:24
d6d7be5 to
fd88312
Compare
jlb6740
marked this pull request as ready for review
August 20, 2026 01:26
Capstone's `disasm_all` stops at the first instruction it can't decode and returns success with whatever it managed to decode. We never compared that against the block length, so that instruction and everything after it vanished from the listing. For `precise-output` filetests the truncated output gets blessed, and the test then passes without asserting anything about those bytes. This is reachable today: the bundled capstone can't decode AVX-VNNI, so a function containing `vpdpbusd` was silently dropping five instructions. It is also a precursor to the APX work, whose EVEX map 4 encodings hit the same path; those filetests were being blessed as truncated output and so verified nothing about the instructions they were added to cover. Print the leftover bytes as `.byte`, keeping the reloc and trap annotations. s390x expectations already look like this. Resyncing after the bad instruction isn't possible on x86 without knowing its length, and guessing yields plausible but wrong instructions. The updated expectations only gain lines; nothing already printed changed. Those blocks end in constant pool data that capstone was already rendering as nonsense. prtest:full
jlb6740
force-pushed
the
fix-disassembler-silent-truncation
branch
from
August 21, 2026 23:30
fd88312 to
32c6a59
Compare
Draft
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.
Capstone's
disasm_allstops at the first instruction it can't decode andreturns success with whatever it managed to decode. We never compared that
against the block length, so that instruction and everything after it
vanished from the listing. For
precise-outputfiletests the truncatedoutput gets blessed, and the test then passes without asserting anything
about those bytes.
This is reachable today: the bundled capstone can't decode AVX-VNNI, so a
function containing
vpdpbusdwas silently dropping five instructions.It is also a precursor to the APX work, whose EVEX map 4 encodings hit the
same path; those filetests were being blessed as truncated output and so
verified nothing about the instructions they were added to cover.
Print the leftover bytes as
.byte, keeping the reloc and trapannotations. s390x expectations already look like this. Resyncing after
the bad instruction isn't possible on x86 without knowing its length, and
guessing yields plausible but wrong instructions.
The updated expectations only gain lines; nothing already printed changed.
Those blocks end in constant pool data that capstone was already rendering
as nonsense.