Shaders: bound the bytes one part's native blobs unpack to and hand out #1620
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from Marvisak/VIctory. Originally posted by imjustprism on 2026-11-24T19:52:31Z.
a 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.
Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-24T19:56:43Z.
Review: APPROVED
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).
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T20:05:29Z.
Review: APPROVED
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).Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T03:31:42Z.
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
Imported from Marvisak/VIctory. Originally posted by StExpeditus on 2026-11-25T09:27:51Z.
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.Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T00:55:28Z.
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.
[PR #1621] bound the bytes one part's native blobs unpack to and hand outto [PR #1621] Shaders: bound the bytes one part's native blobs unpack to and hand outImported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T12:26:18Z.
Review: APPROVED
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.