Shader dxbc: use checked arithmetic for bounds slicing #3380
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!3380
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3380"
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?
@Arkenoz on GitHub · 2026-11-26 21:04 UTC · original
Arkenoz:fix/dxbc-checked-arithmetic→main· +65 −6 · 1 files · 1 commits · openTracked in #1633.
Problem
u16_at,u32_at, andu64_atincrates/victory-shader/src/dxbc.rscomputedat + 2,at + 4, andat + 8with unchecked addition, panicking on overflow whenatis nearusize::MAXinstead of returningErr(ShaderError::Malformed("truncated")).Container::parsecomputedoffset + 4,offset + 8, andoffset + 8 + sizewith unchecked addition.Changes
u16_at,u32_at, andu64_atto usechecked_add, returningErr(ShaderError::Malformed("truncated"))on overflow or out-of-bounds.Container::parseto usechecked_addfor part header and body bounds, returningShaderError::Malformed("part header out of bounds")/ShaderError::Malformed("part data out of bounds").helpers_overflow_safely,parse_rejects_max_offset_and_size) covering near-max offsets andu32::MAXpart offsets/sizes.Verification
cargo test -p victory-shader dxbc(4 passed)cargo clippy -p victory-shader --all-targets(0 warnings)AI-assisted with Gemini.
@Dukestar69 on GitHub · 2026-11-26 21:07 UTC · original · approved these changes
LGTM — verified on Windows against
origin/main(63bcca4).checked_addfor part header/body bounds inContainer::parseand inu16_at/u32_at/u64_atcleanly eliminates arithmetic overflow panics on malformed DXBC containers.cargo test -p victory-shader --lib dxbc:: -- --test-threads=1: 4 passed, 0 failed (includinghelpers_overflow_safelyandparse_rejects_max_offset_and_size).cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@Arkenoz on GitHub · 2026-11-26 21:10 UTC · original
The CI failure is an unrelated flaky test in
victory-gpu(descriptor::host::tests::views_bound_while_another_slot_gets_its_texture_do_not_wait). Could someone re-run the check?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.