GPU: guard zero/overflowing stride in expand_rects and add primitive.rs unit tests #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?
Imported from Marvisak/VIctory. Originally posted by geiyiliyabumo on 2026-11-24T15:24:21Z.
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.