Fuzz the parsers inside cargo test; a damaged shader operand no longer panics #475
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Belobug--VIctory-Belobug-AMD!475
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-475"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@booomxd on GitHub · 2026-11-27 04:56 UTC · original
booomxd:fuzz-parsers→a-publier· +747 −1 · 11 files · 1 commits · openRequested by booomxd · project thread
What
The parsers read bytes nobody vouches for: the user's dump, its import libraries, its shader containers and their programs. A malformed field has to come back as an error, never as a panic. Until now only BCPack and XMA had noise tests.
victory_core::fuzzis a small seeded mutator. It sets known fields to edge values, nudges them, cuts the input short, copies runs over other runs and appends bytes. It runs each target on 4,096 damaged cases of an input that the test builds itself, so no game data is read (rule #1) and CI runs it unchanged. A failure names its target, seed and case.VICTORY_FUZZ_CASESandVICTORY_FUZZ_SEEDlet a developer search longer.spill::build,structure,resource::track,io::raiseandemit.Bug found
In
ir.rs, the search for parked scalars kept one flag per scalar code below 128 (used: [bool; 128]) and indexed it with any code an operand named. A damaged word naming code 255 therefore caused an index out of bounds, which took the run down. The flags now cover all 256 codes, the same size as the arrays beside them. Only codes below 124 are ever read back, so translations of valid programs don't change. The failing case is kept as the regression testan_operand_past_the_scalars_is_no_panic, which fails without the fix and passes with it.Testing
cargo test -p victory-core -p victory-pe -p victory-shader --lib. The new tests pass. The four existingvictory-petests that parse the test executable itself expect a Windows PE, so they fail on Linux as before.cargo clippy --all-targets -D warningspasses, with and without--all-features, for the three crates.cargo xtask policypasses.@MamaLeVrai on GitHub · 2026-11-27 05:38 UTC · original
Tested on an RX 6950 XT (RDNA 2), driver 32.0.21045.29003, Windows 11 build 26300, Rust 1.98.1, release. At
3175f72:victory-shader307 passed, 0 failed, 4 ignored (the fuzz tests included);victory-core17 passed;victory-pe39 passed.AI-assisted (Claude Code); no game data.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.