Shader scan: a raw container's source is exactly the container #288
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!288
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@JordanFableFur on GitHub · 2026-11-24 23:18 UTC · original
JordanFableFur:fix/shader-scan-trailing-bytes→main· +125 −1 · 3 files · 7 commits · openWhat
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.
@chatgpt-codex-connector[bot] on GitHub · 2026-11-24 23:18 UTC · original · edited 2026-11-24 23:20 UTC
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.
@JordanFableFur on GitHub · 2026-11-25 00:32 UTC · original
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.@JordanFableFur on GitHub · 2026-11-25 01:46 UTC · original
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.@chatgpt-codex-connector[bot] on GitHub · 2026-11-24 23:20 UTC · original
On
apps/victory/src/shader.rsline 264 (outdated):The 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 👍 / 👎.
@chatgpt-codex-connector[bot] on GitHub · 2026-11-24 23:20 UTC · original
On
crates/victory-shader/src/dxbc.rsline 120 (outdated):For 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 👍 / 👎.
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.