Shaders: reject DXBC part offsets inside the header or part table #3251

Open
github-bot wants to merge 1 commit from github-bot/gh-3251 into main AGit
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-26 14:38 UTC · original
andrewpozdnakov7-jpg:fix/777-dxbc-part-offsets → main · +33 −0 · 1 files · 1 commits · open

Container::parse reads each part offset from the table and uses it without checking that it lies past the header and the table itself. An offset of 0 reads the container magic back as a part FourCC (DXBC), and an offset inside the table reads neighbour entries as a part header.

The table has to fit inside the container, and every part now has to start at or after HEADER_SIZE + 4 * count. Anything earlier is Malformed("part offset inside the header or part table").

  • rejects_part_offsets_inside_the_header_or_table covers offset 0 and an offset landing inside the table; cargo test -p victory-shader --lib dxbc: 3 passed.
  • Full victory-shader suite with app-local WARP SM 6.6 and active DXIL validation: 300 passed, 3 failed, 3 ignored. The same three fail on 63bcca4 without this change (299 passed, 3 failed, 3 ignored): wave64_permutes_stay_within_each_32_lane_half, permutes_read_the_lane_named_and_zero_from_lanes_left_out, edge_flagged_triangles_draw_as_unflagged_ones, all warp assertions this machine produces.
  • cargo clippy -p victory-shader --all-targets -- -D warnings: clean. cargo xtask policy: 192 files ok.

Valid containers are unaffected: every real part starts after the table, which the round-trip test keeps covering.

Fixes #777.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-26 14:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/3251) `andrewpozdnakov7-jpg:fix/777-dxbc-part-offsets` → `main` · +33 −0 · 1 files · 1 commits · open `Container::parse` reads each part offset from the table and uses it without checking that it lies past the header and the table itself. An offset of 0 reads the container magic back as a part FourCC (`DXBC`), and an offset inside the table reads neighbour entries as a part header. The table has to fit inside the container, and every part now has to start at or after `HEADER_SIZE + 4 * count`. Anything earlier is `Malformed("part offset inside the header or part table")`. - `rejects_part_offsets_inside_the_header_or_table` covers offset 0 and an offset landing inside the table; `cargo test -p victory-shader --lib dxbc`: 3 passed. - Full `victory-shader` suite with app-local WARP SM 6.6 and active DXIL validation: 300 passed, 3 failed, 3 ignored. The same three fail on `63bcca4` without this change (299 passed, 3 failed, 3 ignored): `wave64_permutes_stay_within_each_32_lane_half`, `permutes_read_the_lane_named_and_zero_from_lanes_left_out`, `edge_flagged_triangles_draw_as_unflagged_ones`, all `warp` assertions this machine produces. - `cargo clippy -p victory-shader --all-targets -- -D warnings`: clean. `cargo xtask policy`: 192 files ok. Valid containers are unaffected: every real part starts after the table, which the round-trip test keeps covering. Fixes #777.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 14:39:06 +00:00
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 14:49 UTC · original · approved these changes

Reviewed the diff and verified locally on Windows 11 x64:

  • Validating data.len() >= table_end and offset >= table_end in Container::parse cleanly rejects malformed DXBC part offsets that point into the header or part offset table.
  • cargo test -p victory-shader --lib dxbc:: -- --test-threads=1: 3 passed, 0 failed (including
    ejects_part_offsets_inside_the_header_or_table).
  • cargo clippy -p victory-shader --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-26 14:49 UTC · [original](https://github.com/Marvisak/VIctory/pull/3251#pullrequestreview-6076169768) · **approved these changes** Reviewed the diff and verified locally on Windows 11 x64: - Validating data.len() >= table_end and offset >= table_end in Container::parse cleanly rejects malformed DXBC part offsets that point into the header or part offset table. - cargo test -p victory-shader --lib dxbc:: -- --test-threads=1: 3 passed, 0 failed (including ejects_part_offsets_inside_the_header_or_table). - cargo clippy -p victory-shader --all-targets -- -D warnings: clean. - cargo xtask policy: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3251/head:github-bot/gh-3251'
git switch 'github-bot/gh-3251'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3251'
git switch 'github-bot/gh-3251'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3251'
git switch 'github-bot/gh-3251'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3251'
git switch 'main'
git merge --squash 'github-bot/gh-3251'
git switch 'main'
git merge --ff-only 'github-bot/gh-3251'
git switch 'main'
git merge 'github-bot/gh-3251'
git push origin 'main'
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!3251
No description provided.