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

Open
RenzoWit35 wants to merge 1 commit from upstream-pr/328 into main
RenzoWit35 commented 2026-11-24 23:34:44 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by RenzoWit35 on 2026-11-24T23:34:44Z.


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

<!-- greyfinch-sync:fxceless/victory-fork:issue:6593597430 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/328). Originally posted by [RenzoWit35](https://github.com/RenzoWit35) on 2026-11-24T23:34:44Z. --- 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)
kaayzouee commented 2026-11-25 02:10:07 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by kaayzouee on 2026-11-25T01:26:49Z.


Duplicate of #288?

<!-- greyfinch-sync:fxceless/victory-fork:comment:7149554808 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/328#issuecomment-7149554808). Originally posted by [kaayzouee](https://github.com/kaayzouee) on 2026-11-25T01:26:49Z. --- Duplicate of #288?
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/328:upstream-pr/328'
git switch 'upstream-pr/328'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/328'
git switch 'upstream-pr/328'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/328'
git switch 'upstream-pr/328'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/328'
git switch 'main'
git merge --squash 'upstream-pr/328'
git switch 'main'
git merge --ff-only 'upstream-pr/328'
git switch 'main'
git merge 'upstream-pr/328'
git push origin 'main'
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
fxceless/victory-fork!328
No description provided.