victory-recomp: avoid u64::wrapping_shr(64) no-op in vertex stream binding #81

Open
github-bot wants to merge 1 commit from github-bot/gh-81 into main AGit
Owner

@⁠ending3729 on GitHub · 2026-12-05 23:31 UTC · original
ending3729:fix/vertex-stream-mask-shift-overflow → main · +53 −7 · 1 files · 1 commits · open

Summary

  • Fix an infinite loop and out-of-bounds read in bind_draw_vertex_streams_inner (crates/victory-recomp/src/render.rs) when bit 63 is the lowest remaining set bit in decl_mask (decl_mask.trailing_zeros() == 63, shift == 64).
  • u64::wrapping_shr(64) masks the shift count modulo 64 (64 & 63 == 0), leaving both pipe_mask and decl_mask unchanged when pipe_mask != 0, incrementing elem_idx unboundedly, and reading past elem_arr.
  • Extract advance_vertex_stream_masks(pipe_mask, decl_mask) using checked_shr(shift).unwrap_or(0) and add unit test render::tests::advance_vertex_stream_masks_handles_bit63_without_wrapping.
Check Outcome
cargo test -p victory-recomp --locked Passed (30 passed; 0 failed)
cargo clippy --workspace --all-targets --locked -- -D warnings Passed (0 warnings)
cargo clippy --workspace --all-targets --all-features --locked -- -D warnings Passed (0 warnings)
cargo xtask policy Passed (asset policy: 452 files ok)
Verification notes
  • Retail game dump assets are not available locally; verification relies on the unit test in crates/victory-recomp/src/render.rs (advance_vertex_stream_masks_handles_bit63_without_wrapping) plus full workspace Clippy and asset-policy checks.
  • Pre-fix Red run confirmed advance_vertex_stream_masks(u64::MAX, 1u64 << 63) returned (u64::MAX, 1u64 << 63) under wrapping_shr(64) before switching to checked_shr(shift).unwrap_or(0).

AI-assisted: yes

**@⁠ending3729** on GitHub · 2026-12-05 23:31 UTC · [original](https://github.com/VGLALALA/ReVictory-RDNA3/pull/81) `ending3729:fix/vertex-stream-mask-shift-overflow` → `main` · +53 −7 · 1 files · 1 commits · open ## Summary - Fix an infinite loop and out-of-bounds read in `bind_draw_vertex_streams_inner` (`crates/victory-recomp/src/render.rs`) when bit 63 is the lowest remaining set bit in `decl_mask` (`decl_mask.trailing_zeros() == 63`, `shift == 64`). - `u64::wrapping_shr(64)` masks the shift count modulo 64 (`64 & 63 == 0`), leaving both `pipe_mask` and `decl_mask` unchanged when `pipe_mask != 0`, incrementing `elem_idx` unboundedly, and reading past `elem_arr`. - Extract `advance_vertex_stream_masks(pipe_mask, decl_mask)` using `checked_shr(shift).unwrap_or(0)` and add unit test `render::tests::advance_vertex_stream_masks_handles_bit63_without_wrapping`. | Check | Outcome | |---|---| | `cargo test -p victory-recomp --locked` | Passed (`30 passed; 0 failed`) | | `cargo clippy --workspace --all-targets --locked -- -D warnings` | Passed (0 warnings) | | `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings` | Passed (0 warnings) | | `cargo xtask policy` | Passed (`asset policy: 452 files ok`) | <details> <summary>Verification notes</summary> - Retail game dump assets are not available locally; verification relies on the unit test in `crates/victory-recomp/src/render.rs` (`advance_vertex_stream_masks_handles_bit63_without_wrapping`) plus full workspace Clippy and asset-policy checks. - Pre-fix Red run confirmed `advance_vertex_stream_masks(u64::MAX, 1u64 << 63)` returned `(u64::MAX, 1u64 << 63)` under `wrapping_shr(64)` before switching to `checked_shr(shift).unwrap_or(0)`. </details> AI-assisted: yes
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-05 23:34:27 +00:00
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/81/head:github-bot/gh-81'
git switch 'github-bot/gh-81'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-81'
git switch 'github-bot/gh-81'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-81'
git switch 'github-bot/gh-81'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-81'
git switch 'main'
git merge --squash 'github-bot/gh-81'
git switch 'main'
git merge --ff-only 'github-bot/gh-81'
git switch 'main'
git merge 'github-bot/gh-81'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.