GPU: guard zero/overflowing stride in expand_rects and add primitive.rs unit tests #1061
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#1061
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@geiyiliyabumo on GitHub · 2026-11-24 15:24 UTC · original
Summary
Guards
expand_rectsincrates/victory-gpu/src/primitive.rsagainst zero or overflowingstride(which previously panicked inchunks_exact(0)or6 * stridearithmetic) and adds 3 deterministic synthetic unit tests (7 total inprimitive.rs).Because external PR creation is currently restricted (
collaborators_only), the CI-green branch is ready on my fork for cherry-pick / review:geiyiliyabumo/VIctory@test/gpu-primitive-auditgeiyiliyabumo/VIctory@e3c9dd0(based onmainffe310e)Changes (
crates/victory-gpu/src/primitive.rs)expand_rectsnow returns early whenstride == 0orstride.checked_mul(3)/stride.checked_mul(6)overflows.zero_or_overflowing_stride_is_ignored_without_panickingunorm16_unorm8_clamping_and_unknown_formats_expand_correctlymultiple_rectangles_and_f32_f16_vector_formats_expand_in_sequenceVerification (Windows 11 x64 MSVC)
rustfmt --edition 2024 --check crates/victory-gpu/src/primitive.rs: PASScargo xtask policy: PASS (154 files ok)cargo clippy -p victory-gpu --all-targets --locked -- -D warnings(default +--features diagnostics): PASS (0 warnings)cargo test -p victory-gpu --locked -- primitive::: 7 passed, 0 failedAI-assisted; synthetic tests only, no game files.