GPU: a copy footprint whose sizes overflow spans no bytes #2302

Closed
denkencar-sketch wants to merge 1 commit from upstream-pr/2304 into main
denkencar-sketch commented 2026-11-25 10:05:48 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by denkencar-sketch on 2026-11-25T10:05:48Z.


Summary

PlacedFootprint::bytes multiplied the title's pitch, height and depth unchecked: a panic in checked builds, a small wrapped size in release. A footprint whose sizes overflow now spans no bytes.

Testing

Test footprints_that_overflow_span_no_bytes fails on main and passes with this change. cargo test --workspace --locked passes apart from known flakes: modules::dstorage::tests::a_page_list_filled_after_its_request_starts fails now and then on main too, and so does a parallel-run flake in victory-gpu's lib tests (watch:: and descriptor::host:: tests, 2 of 40 runs on pristine main).

Not tried: a run in the game.

AI-assisted.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6601989096 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2304). Originally posted by [denkencar-sketch](https://github.com/denkencar-sketch) on 2026-11-25T10:05:48Z. --- ## Summary `PlacedFootprint::bytes` multiplied the title's pitch, height and depth unchecked: a panic in checked builds, a small wrapped size in release. A footprint whose sizes overflow now spans no bytes. ## Testing Test `footprints_that_overflow_span_no_bytes` fails on `main` and passes with this change. `cargo test --workspace --locked` passes apart from known flakes: `modules::dstorage::tests::a_page_list_filled_after_its_request_starts` fails now and then on `main` too, and so does a parallel-run flake in `victory-gpu`'s lib tests (`watch::` and `descriptor::host::` tests, 2 of 40 runs on pristine `main`). Not tried: a run in the game. AI-assisted.
catminou4 commented 2026-11-25 11:04:43 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T10:19:20Z.

Review: COMMENTED


PlacedFootprint::bytes uses checked_mul — overflowing title numbers span no bytes instead of wrapping. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1.

<!-- greyfinch-sync:Marvisak/VIctory:review:6055714193 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2304#pullrequestreview-6055714193). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T10:19:20Z. **Review:** COMMENTED --- PlacedFootprint::bytes uses checked_mul — overflowing title numbers span no bytes instead of wrapping. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1.
DenRakEiw commented 2026-11-25 11:04:43 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T10:21:58Z.

Review: APPROVED


Verified against origin/main (940d32f) on Windows 11 + NVIDIA GeForce RTX 5090 and WARP:

  • Using checked_mul / checked_add in PlacedFootprint::bytes cleanly turns overflowing title footprints into None instead of wrapping/panicking.
  • cargo test -p victory-gpu resource::tests: 11/11 passed on RTX 5090, 11/11 passed on WARP (including footprints_that_overflow_span_no_bytes).
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: 0 warnings.
  • cargo xtask policy: 183 files ok.

AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6055750606 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2304#pullrequestreview-6055750606). Originally posted by [DenRakEiw](https://github.com/DenRakEiw) on 2026-11-25T10:21:58Z. **Review:** APPROVED --- Verified against `origin/main` (`940d32f`) on Windows 11 + NVIDIA GeForce RTX 5090 and WARP: - Using `checked_mul` / `checked_add` in `PlacedFootprint::bytes` cleanly turns overflowing title footprints into `None` instead of wrapping/panicking. - `cargo test -p victory-gpu resource::tests`: 11/11 passed on RTX 5090, 11/11 passed on WARP (including `footprints_that_overflow_span_no_bytes`). - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: 0 warnings. - `cargo xtask policy`: 183 files ok. AI-assisted (Gemini 4 Neon).
Marvisak commented 2026-11-25 16:09:10 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T15:21:36Z.


Automated triage for the maintainers.

Proposed close. PlacedFootprint::bytes in crates/victory-gpu/src/resource.rs can only overflow in row_pitch * (lines - 1), which needs a footprint describing a buffer larger than 2^64 bytes; no real copy footprint does. Its only caller, the footprint branch of the copy path in list.rs (around line 534), already passes the result through buffer_range, so a wrapped value is rejected there anyway. The test covers only made-up u32::MAX sizes. A real footprint that overflows here would change the verdict. (Side note: the test module now has a test function between use super::PlacedFootprint; and use super::*;, and the first import is redundant.)

This PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the label.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7166718529 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2304#issuecomment-7166718529). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T15:21:36Z. --- <!-- victory-triage v1 head=a014430ad4094432fbd9ba8faa757bd58d8d1857 verdict=proposed-close at=2026-11-25T15:29:00Z --> Automated triage for the maintainers. **Proposed close.** `PlacedFootprint::bytes` in `crates/victory-gpu/src/resource.rs` can only overflow in `row_pitch * (lines - 1)`, which needs a footprint describing a buffer larger than 2^64 bytes; no real copy footprint does. Its only caller, the footprint branch of the copy path in `list.rs` (around line 534), already passes the result through `buffer_range`, so a wrapped value is rejected there anyway. The test covers only made-up `u32::MAX` sizes. A real footprint that overflows here would change the verdict. (Side note: the test module now has a test function between `use super::PlacedFootprint;` and `use super::*;`, and the first import is redundant.) This PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the label. --- _Generated by [Claude Code](https://claude.ai/code)_
upstream-sync closed this pull request 2026-11-26 00:01:51 +00:00
denkencar-sketch commented 2026-11-26 00:03:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by denkencar-sketch on 2026-11-25T23:12:07Z.


Closing per triage: overflowing \PlacedFootprint::bytes\ requires a >2^64-byte footprint and the caller already rejects wrapped values via \uffer_range.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7177259271 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2304#issuecomment-7177259271). Originally posted by [denkencar-sketch](https://github.com/denkencar-sketch) on 2026-11-25T23:12:07Z. --- Closing per triage: overflowing \PlacedFootprint::bytes\ requires a >2^64-byte footprint and the caller already rejects wrapped values via \uffer_range\.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!2302
No description provided.