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

Closed
SkippySteve wants to merge 1 commit from upstream-pr/330 into main
SkippySteve commented 2026-11-24 02:20:51 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by SkippySteve on 2026-11-24T02:20:51Z.


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
<!-- greyfinch-sync:Marvisak/VIctory:issue:6573150711 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/330). Originally posted by [SkippySteve](https://github.com/SkippySteve) on 2026-11-24T02:20:51Z. --- `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
upstream-sync closed this pull request 2026-11-24 06:52:26 +00:00
SkippySteve commented 2026-11-24 06:55:09 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by SkippySteve on 2026-11-24T02:22:47Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7120078610 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/330#issuecomment-7120078610). Originally posted by [SkippySteve](https://github.com/SkippySteve) on 2026-11-24T02:22:47Z. --- superseded by #333 (combined native.rs: SGPR bound + refusal tests)

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!330
No description provided.