Shader tests: name the reason each native blob is refused #330

Closed
github-bot wants to merge 1 commit from gh-pr/330/head into gh-pr/330/base
Owner

@⁠SkippySteve on GitHub · 2026-11-24 02:20 UTC · original
SkippySteve/shader-native-refusals → main · +163 −0 · 1 files · 1 commits · closed without merging

rejects_corrupt_blobs in victory-shader/src/native.rs only asserts is_err(). So if one check stopped firing, the test would still pass whenever a later check happened to catch the same bytes.

This adds tests only (no behaviour change). Each Malformed reason native_programs can return now has a case that expects that exact message:

  • XDAT: implausible entry count, entry out of bounds. Entries of other kinds are never read, so their bounds don't matter; that is pinned too.
  • XBCH: magic, version, implausible unpacked size, stream out of bounds, a stated size one byte either side of the inflated length, truncated header.
  • FSSM header: magic, version, payload size, slot count, record out of bounds.
  • Record: code out of bounds, VGPR count 257 (256 still passes), root table out of bounds.
  • Stage data: VS input/output and PS input semantic counts, export patch size, and a patch at the code's last dword (passes) versus one past it (refused).

All blobs are built in the test by the existing synthetic fssm/xbch/part helpers. There is no title data.

Tested on Linux:

  • cargo test -p victory-shader: 61 passed
  • cargo clippy -p victory-shader --all-targets: no new warnings. The one warning, constant_color unused in emit/mod.rs, is already on main.
  • cargo fmt --check: clean
**@⁠SkippySteve** on GitHub · 2026-11-24 02:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/330) `SkippySteve/shader-native-refusals` → `main` · +163 −0 · 1 files · 1 commits · closed without merging `rejects_corrupt_blobs` in `victory-shader/src/native.rs` only asserts `is_err()`. So if one check stopped firing, the test would still pass whenever a later check happened to catch the same bytes. This adds tests only (no behaviour change). Each `Malformed` reason `native_programs` can return now has a case that expects that exact message: - **XDAT**: implausible entry count, entry out of bounds. Entries of other kinds are never read, so their bounds don't matter; that is pinned too. - **XBCH**: magic, version, implausible unpacked size, stream out of bounds, a stated size one byte either side of the inflated length, truncated header. - **FSSM header**: magic, version, payload size, slot count, record out of bounds. - **Record**: code out of bounds, VGPR count 257 (256 still passes), root table out of bounds. - **Stage data**: VS input/output and PS input semantic counts, export patch size, and a patch at the code's last dword (passes) versus one past it (refused). All blobs are built in the test by the existing synthetic `fssm`/`xbch`/`part` helpers. There is no title data. Tested on Linux: - `cargo test -p victory-shader`: 61 passed - `cargo clippy -p victory-shader --all-targets`: no new warnings. The one warning, `constant_color` unused in `emit/mod.rs`, is already on `main`. - `cargo fmt --check`: clean
The corrupt-blob test only checked that native_programs fails, so a
check could stop firing while an earlier one caught the same bytes.
Each XDAT, XBCH, FSSM, record and stage-data refusal now has a case that
expects its own message, with the boundaries that still pass (256
VGPRs, a patch ending at the code's last dword, out-of-range entries
of other kinds).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:59:30 +00:00
github-bot closed this pull request 2026-11-26 03:59:30 +00:00
Author
Owner

@⁠SkippySteve on GitHub · 2026-11-24 02:22 UTC · original

superseded by #333 (combined native.rs: SGPR bound + refusal tests)

**@⁠SkippySteve** on GitHub · 2026-11-24 02:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/330#issuecomment-7120078610) superseded by #333 (combined native.rs: SGPR bound + refusal tests)

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!330
No description provided.