Game: validate DXBC containers in SGD5 records #425
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!425
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-425"
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?
@enzoduarte1 on GitHub · 2026-11-24 03:14 UTC · original
enzoduarte1:game/sgd5-dxbc-container→main· +91 −0 · 1 files · 1 commits · openWhat
Record::unpack()in the SGD5 reader only checks that the deflate stream inflates to the declared length. A record can hold arbitrary bytes, so callers that need a shader container each have to repeat the DXBC header checks (or skip the record later, after counting it).This adds two accessors to
victory-game::sgd5::Record:container(): unpacks and returns the bytes only when they have a DXBC header whose total size and part-offset table fit inside the data;digest(): the 16-byte container digest from that header, for identifying a shader without unpacking again.Both return
Nonefor corrupt streams, non-DXBC payloads and malformed headers.unpack()keeps its existing behavior. Tests use synthetic buffers only: a valid two-part container, a non-shader payload, bad magic, out-of-range total size, part count overflow and a truncated header. No title data is involved.Tested
x86_64-pc-windows-gnu(no MSVC linker on this machine).cargo test -p victory-game: 4 passed.cargo test --workspace --exclude victory-loader -- --test-threads=1: all suites passed.cargo clippy -p victory-game --all-targets -- -D warnings: clean.rustfmt --edition 2024 --check crates/victory-game/src/sgd5.rsandgit diff --check: clean.cargo xtask policy: 151 files ok. No game files or data taken from them were added.cargo test -p victory-loader --test load_probe. Its fixture passes MSVC's/DELAYLOADflag, which MinGW rejects here; the same failure occurs on unmodifiedmain.Checklist
cargo fmt,cargo clippy --workspace --all-targetsandcargo test --workspacepass — see the toolchain limitations above; the changed crate is clean.cargo xtask policypasses. The change adds no game files or data taken from them (docs/asset-policy.md).@DaviTostes on GitHub · 2026-11-24 03:38 UTC · original
Verified
012ce71on Arch Linux x86_64 (rustc 1.98.1,cargo test -p victory-game): 4 passed, 0 failed, 0 ignored.Not covered: SGD5 streams from the title's archives (no game data here).
@Marvisak on GitHub · 2026-11-25 00:17 UTC · original
Automated triage for the maintainers.
Needs rebase. This PR does not merge cleanly into current
main(ac2525d). Conflicting files:crates/victory-game/src/sgd5.rs.The content has not been reviewed yet; it will be once the branch is rebased onto
main.Generated by Claude Code
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.