Shaders: bound the bytes one part's native blobs unpack to and hand out #1621
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!1621
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1621"
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?
@imjustprism on GitHub · 2026-11-24 19:52 UTC · original
imjustprism:fix/native-program-size-budget→main· +104 −13 · 1 files · 1 commits · opena dxil part's xdat index can name the same native blob up to 64 times, and a blob's 8 stage slots can all point at one code range. each blob was only capped at 16 MiB unpacked on its own, so a container of a few KB could make native_programs inflate 1 GiB and copy out about 8 GiB of code before translation even starts. the bytes a part's blobs unpack to and the code and raw table bytes read out of them now come off one 16 MiB budget, and running out is refused as malformed.
real blobs are a few KiB. on a retail dump all 26,148 native programs still read and none hits the new refusal (that run was on an earlier revision of this branch with the same limits). four synthetic tests, each fails without its part of the change. clippy both ways, cargo test --workspace (346 passed) and xtask policy on windows 11.
@Marvisak on GitHub · 2026-11-25 03:31 UTC · original
Automated triage for the maintainers.
Merge candidate. This replaces the per-blob
MAX_UNPACKEDcap innative.rswith one 16 MiBPartBudgetper part, covering the unpacked sizes and the code and root-table bytes copied out. That closes the case where one XDAT index names the same blob many times, or a blob's stages share one range. The size is checked before inflating, theusizeconversion saturates, and the four tests each cover one path. The author reports that every retail program still reads. CI passes.Generated by Claude Code
@StExpeditus on GitHub · 2026-11-25 09:27 UTC · original
Test report: RTX 5060 Ti (Blackwell), Windows 11 Pro 26200, driver 621.24. Branch at
46b2086.cargo test --workspace --locked --no-fail-fast-> 697 passed, 5 failed, 10 ignored. The failures are the same 5 pre-existing NVIDIA 1M-view-heap-cap failures (also on main; see my reports on #2030 and #1940). Nothing introduced by this PR fails on this machine.@fuzeofficlal on GitHub · 2026-11-26 00:55 UTC · original
Code review and Windows 11 verification at head
46b2086986d0merged cleanly ontomain(63bcca43c6a0):crates/victory-shader/src/native.rs:486-500, 586-648):PartBudget(MAX_PART_BYTES = 16 MiB)debits withchecked_subacross the entire part loop (0..count), charging both declaredunpackedsize (viausize::try_from(...).unwrap_or(usize::MAX)beforedecompress_to_vec_zlib_with_limitallocates) and extractedcode.len() + layout.len() + used.len()(bounded well below overflow since each blob is<= 16 MiB). This prevents both multi-entry zlib inflation and overlapping multi-stage slice amplification from the same blob while returning a clearMalformederror.cargo xtask policy:191 files ok;cargo clippy -p victory-shader -p victory-pipeline --all-targets -- -D warnings: 0 warningsvictory-shader --lib -- native::: 17/17 passed (including all 4 new budget tests)victory-pipeline --all-targets: 8/8 passed.LGTM.
bound the bytes one part's native blobs unpack to and hand outto Shaders: bound the bytes one part's native blobs unpack to and hand out@DenRakEiw on GitHub · 2026-11-24 19:56 UTC · original · approved these changes
Verified locally merged onto
origin/main(Windows 11 x64, Rust 1.98.1 MSVC):cargo test -p victory-shader --lib native::— 14 passed, 0 failed (including the 4 newPartBudgetsize-budget tests)cargo clippy -p victory-shader --all-targets— 0 warningscargo xtask policy— okClean
PartBudgetaccounting for unpacked native blobs, code, and root tables so oversized blobs are rejected before inflating. Looks good.AI-assisted (Gemini 4 Neon).
@catminou4 on GitHub · 2026-11-24 20:05 UTC · original · approved these changes
Native blob unpacking is now bounded by a
PartBudget: code, root tables and unpacked blob bytes all come off one budget, and an oversized blob is refused before it inflates (zip-bomb protection for malformed SGDs). Four new tests cover each budget site and the early refusal. macOS arm64:cargo test -p victory-shader --locked→ 100 passed, 0 failed (+4).@fuzeofficlal on GitHub · 2026-11-26 12:26 UTC · original · approved these changes
Reviewed and verified
46b20869againstorigin/main(63bcca43; cleangit merge-tree):PartBudget(16 << 20)(crates/victory-shader/src/native.rs:143-152, 454, 595-596, 645-647) checks saturatedunpackedsizes (usize::try_from(...).unwrap_or(usize::MAX)) withchecked_subbefore inflating and chargescode.len() + layout.len() + used.len()before copying/collecting, preventing repeated XDAT entries and shared stage ranges from amplifying allocations.Non-blocking boundary note: because decompression (
S) and emitted code/table bytes (P) now share one 16 MiB budget, a single valid code-heavy blob just above ~8 MiB (S + P > 16 MiB) that previously passedMAX_UNPACKED = 16 MiBwill now be refused. Documenting that single-blob boundary (or adding exact16 MiB/16 MiB + 1 Bboundary tests) would lock the contract down cleanly.Local verification on
46b20869:rustfmt --edition 2024 --check crates/victory-shader/src/native.rs,xtask policy(182 files ok),cargo clippy -p victory-shader --all-targets -- -D warnings(default &--all-features), andcargo test -p victory-shader --lib native::(17 passed; 0 failed) all pass.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.