Shader tests: cover each way a DXIL program header is refused #300
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!300
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/300/head"
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?
@SkippySteve on GitHub · 2026-11-24 02:09 UTC · original
SkippySteve/dxil-reject-tests→main· +86 −0 · 1 files · 1 commits · closed without mergingDxilProgram::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: clean@SkippySteve on GitHub · 2026-11-24 02:29 UTC · original
superseded by #326 (combined shader DX/parser robustness)
Pull request closed