Shader scan: a raw container's source is exactly the container #288
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/288"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from fxceless/victory-fork. Originally posted by JordanFableFur on 2026-11-24T23:18:17Z.
What
Source::Raw::byteshanded a run the whole slice from a DXBC magic to the file's end, andtranslatehashed those bytes (blake3::hash(&bytes)). A container with trailing file bytes after its declared length was then a different hash from the same container read at its own length, soVICTORY_TRANSLATE_ONLY=<hash>could not match it from a runtime log, and the longer slice flowed intoVICTORY_DUMP_MATCH/VICTORY_FAIL_DUMPfiles.The raw source now cuts to the container's parsed size, exposed as
Container::size(the lengthparsealready validates and cuts its own view to). Packed SGD5 records are unchanged:unpackreturns exactly the record's bytes.Fixes #246.
Testing
Synthetic: a one-part container (
dxbc::buildshape) scanned as a standalone file and as the same bytes followed byharmless tailnow gives identical source bytes. New testa_container_and_its_copy_with_a_tail_hash_the_sameinapps/victory/src/shader.rs.cargo clippy --workspace --all-targets --locked -- -D warningsclean (cross-checked for the Windows target; no Windows machine here).cargo test -p victory-shader -p victory-core -p victory-formats -p victory-pipeline -p xtaskpass (209 tests). Thevictorybin's tests need the MSVC linker, not available on this Mac; the new test compiles there (cargo test -p victory --no-runpasses up to linking).AI use: written with a local GLM-5.3-Flash agent (pi); reviewed and posted with my approval. No game files were used.
Imported from fxceless/victory-fork. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T23:20:52Z.
Review: COMMENTED
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
e40b8bb091ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Imported from fxceless/victory-fork. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T23:18:33Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
e40b8bbℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
Imported from fxceless/victory-fork. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T23:20:53Z.
Code review location:
apps/victory/src/shader.rs; line 264The buffer contains only one DXBC container:
standalone.clone()copies it once, andb"harmless tail"adds no second container. Consequently,sources(&file)returns one element, this pattern always takes the panic branch with1 containers, and the Windows CITestsstep in.github/workflows/ci.ymlfails. Scanstandaloneseparately to compare its source bytes against the source found infile.Useful? React with 👍 / 👎.
Imported from fxceless/victory-fork. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T23:20:53Z.
Code review location:
crates/victory-shader/src/dxbc.rs; line 120For containers that the parser accepts with an out-of-order part-offset table or padding inside the declared total size, the last table entry's end is smaller than the container length. For example, a 52-byte container whose final part ends at byte 48 returns 48 here.
Source::Raw::bytes()then truncates it while leaving 52 in its header, so subsequent parsing fails and the shader survey and translator reject an input that worked before this change. Preserve and return thetotalread byparseinstead of reconstructing it from the last part.Useful? React with 👍 / 👎.
Imported from fxceless/victory-fork. Originally posted by JordanFableFur on 2026-11-25T00:32:54Z.
Both findings addressed in
c996e1c:Container::sizereturns the header's parsed total (stored onContainer), not the last part's end, so padding inside the declared length survives; a regression scans a container with room after its last part and reads the declared length back.Imported from fxceless/victory-fork. Originally posted by JordanFableFur on 2026-11-25T01:46:35Z.
For the duplicate sweep (#328 fixes the same issue): this PR was opened first (23:18 vs 23:34) and already carries resolutions to both of its review findings (the test scans the standalone separately;
Container::sizereturns the header's declared length, so padding inside the declared total survives). Happy to withdraw it if #328 is preferred for other reasons.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.