Shader tests: cover each way a DXIL program header is refused #300
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/300"
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?
Imported from Marvisak/VIctory. Originally posted by SkippySteve on 2026-11-24T02:09:55Z.
DxilProgram::parse(crates/victory-shader/src/dxil.rs) can refuse a program in five ways: a size the part cannot hold, a missingDXILmagic, bitcode out of bounds, no LLVM magic, and a bitcode offset inside the header. It also cuts the part down to the program's own size before reading the trailer. The tests only reached the LLVM-magic case.This adds synthetic-header tests for:
u32::MAXdwords (thechecked_mulpath), plus a truncated headerDXBCwhereDXILshould bexbopthere would otherwise flag a PC program as Xbox)ShaderKind::Unknownand not refusedEach rejection test checks its exact
Malformedmessage, so a check that moves or merges with another shows up. I checked that the tests catch real regressions: dropping&part[..size]and thes >= 24bound makes two of the new tests fail.The change is tests only, with no code changes. Everything is built from synthetic bytes, with no shader or game data.
Testing (Linux,
x86_64-unknown-linux-gnu):cargo test -p victory-shader: 62 passedcargo clippy -p victory-shader --tests: only theconstant_colordead-code warning thatmainalready hascargo fmt --check: cleanImported from Marvisak/VIctory. Originally posted by SkippySteve on 2026-11-24T02:29:28Z.
superseded by #326 (combined shader DX/parser robustness)
Pull request closed