Shader scan: a raw DXBC container's source is exactly its declared length #328

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

@⁠RenzoWit35 on GitHub · 2026-11-24 23:34 UTC · original
RenzoWit35:fix/246-dxbc-source-exact-range → main · +52 −5 · 2 files · 1 commits · open

Fixes #246.

sources() gave a raw container &data[offset..], so trailing bytes (and any later containers)
went into its hash and dumps, and VICTORY_TRANSLATE_ONLY could not match the hash from
runtime logs. dxbc::Container now exposes the checked total size (size), and the scan
slices exactly that.

Test raw_source_is_exactly_the_declared_container: a synthetic 32-byte container standalone
and with bytes before and after gives identical bytes and blake3 hashes. Fails on main (45
bytes).

Note: this adds a public field to victory_shader::dxbc::Container. Nothing outside parse
builds one.

Testing

On Windows 11, MSVC Rust 1.98.1, branch alone on top of main (2119b0e): cargo clippy --workspace --all-targets --locked -- -D warnings, the same with --all-features, and cargo test --workspace --locked all pass. The new regression test fails on main and passes here. All nine fix branches for #242-#250 also pass together when merged.

🤖 Generated with Claude Code

**@⁠RenzoWit35** on GitHub · 2026-11-24 23:34 UTC · [original](https://github.com/fxceless/victory-fork/pull/328) `RenzoWit35:fix/246-dxbc-source-exact-range` → `main` · +52 −5 · 2 files · 1 commits · open Fixes #246. `sources()` gave a raw container `&data[offset..]`, so trailing bytes (and any later containers) went into its hash and dumps, and `VICTORY_TRANSLATE_ONLY` could not match the hash from runtime logs. `dxbc::Container` now exposes the checked total size (`size`), and the scan slices exactly that. Test `raw_source_is_exactly_the_declared_container`: a synthetic 32-byte container standalone and with bytes before and after gives identical bytes and blake3 hashes. Fails on `main` (45 bytes). Note: this adds a public field to `victory_shader::dxbc::Container`. Nothing outside `parse` builds one. ## Testing On Windows 11, MSVC Rust 1.98.1, branch alone on top of `main` (2119b0e): `cargo clippy --workspace --all-targets --locked -- -D warnings`, the same with `--all-features`, and `cargo test --workspace --locked` all pass. The new regression test fails on `main` and passes here. All nine fix branches for #242-#250 also pass together when merged. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A container found by its magic was sliced to the end of the file, so any
bytes after it (including later containers) went into its hash and dumps,
and VICTORY_TRANSLATE_ONLY could not match the hash a run logs. The parser
now reports the total size it checked, and the scan slices to it. A test
scans a synthetic 32-byte container alone and embedded with a lead and a
tail, and gets the same bytes and hash.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:40:50 +00:00
Author
Owner

@⁠kaayzouee on GitHub · 2026-11-25 01:26 UTC · original

Duplicate of #288?

**@⁠kaayzouee** on GitHub · 2026-11-25 01:26 UTC · [original](https://github.com/fxceless/victory-fork/pull/328#issuecomment-7149554808) Duplicate of #288?
This pull request can be merged automatically.
This branch is out-of-date with the base branch
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/328/head:github-bot/gh-328'
git switch 'github-bot/gh-328'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-328'
git switch 'github-bot/gh-328'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-328'
git switch 'github-bot/gh-328'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-328'
git switch 'main'
git merge --squash 'github-bot/gh-328'
git switch 'main'
git merge --ff-only 'github-bot/gh-328'
git switch 'main'
git merge 'github-bot/gh-328'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.