Shaders: bounds-check DXIL header offsets and recognize dword zero padding #1303
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1303"
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 Marvisak/VIctory. Originally posted by geiyiliyabumo on 2026-11-24T17:17:23Z.
Summary
Audits \crates/victory-shader/src/dxil.rs\ and fixes two parser/layout issues:
Verification
AI-assisted; synthetic tests only, no game files.
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T20:09:43Z.
Review: APPROVED
Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (
ffe310e), cargo test -p victory-shader --locked → 100 passed, 0 failed. Execution/valu tests are #[cfg(all(test, windows))] and only run on Windows; macOS covers lowering/structure/IR unit tests.Bounds-checks DXIL header offsets with split_at_checked (no more start+len overflow) and treats dword-zero padding as trailer: is_standard_layout now accepts exactly the zero padding to a dword boundary and rejects any other trailer byte. Tests cover every truncation length, invalid header fields, and all four padding lengths.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T02:34:16Z.
Automated triage for the maintainers. Thank you for the careful tests, but this adds guards for cases that cannot occur. VIctory builds only for
x86_64-pc-windows-msvc(rust-toolchain.toml), and on 64-bitusize,8 + offset + lenfrom twou32fields cannot overflow; out-of-range values were already rejected by the existingget(..). LLVM's bitstream writer emits whole 32-bit words, so DXIL bitcode never needs the 1-3 bytes of padding thatis_standard_layoutwould now accept. Also, nothing in the workspace callsDxilProgram::parseexcept its own tests incrates/victory-shader/src/dxil.rs, so behaviour does not change. A malformed input thatmainhandles wrongly, or a caller that needs the change, would change this verdict. This PR will be closed in 48 hours unless the author pushes a change or a maintainer removes thetriage: proposed closelabel.Generated by Claude Code
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.