Return early on empty range in inplace::views_gone #351

Manually merged
github merged 1 commit from github-bot/gh-351 into gh-pr/351/base 2026-11-27 19:27:44 +00:00 AGit
Owner

@⁠ahmetbagci8 on GitHub · 2026-11-27 19:11 UTC · original
ahmetbagci8:fix/gpu-inplace-views-gone-empty → main · +14 −0 · 1 files · 1 commits · merged 2026-11-27 19:24 UTC

Summary

In crates/victory-gpu/src/inplace.rs, views_gone(at, 0) computed end = at.saturating_add(0) = at and called v.views.range(at.saturating_add(1)..end) when v.views was non-empty, which panics in BTreeMap::range (range start is greater than range end). Even without the panic, first would match and remove any view covering at despite [at, at + 0) being empty.

Changes

  • Return early when len == 0 at the start of views_gone.
  • Add unit test views_gone_empty_range_leaves_existing_views_alone.

Tested

  • cargo test -p victory-gpu --lib inplace: 9 passed; 0 failed; 0 ignored
  • cargo clippy -p victory-gpu --tests: clean (0 warnings)
**@⁠ahmetbagci8** on GitHub · 2026-11-27 19:11 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/351) `ahmetbagci8:fix/gpu-inplace-views-gone-empty` → `main` · +14 −0 · 1 files · 1 commits · merged 2026-11-27 19:24 UTC ### Summary In `crates/victory-gpu/src/inplace.rs`, `views_gone(at, 0)` computed `end = at.saturating_add(0) = at` and called `v.views.range(at.saturating_add(1)..end)` when `v.views` was non-empty, which panics in `BTreeMap::range` (`range start is greater than range end`). Even without the panic, `first` would match and remove any view covering `at` despite `[at, at + 0)` being empty. ### Changes - Return early when `len == 0` at the start of `views_gone`. - Add unit test `views_gone_empty_range_leaves_existing_views_alone`. ### Tested - `cargo test -p victory-gpu --lib inplace`: `9 passed; 0 failed; 0 ignored` - `cargo clippy -p victory-gpu --tests`: clean (0 warnings)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 19:11:43 +00:00
github-bot changed target branch from main to gh-pr/351/base 2026-11-27 19:27:42 +00:00
github manually merged commit 8ffcd0ee3f into gh-pr/351/base 2026-11-27 19:27:44 +00:00
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-27 19:27 UTC · original

@⁠ahmetbagci8 Merged as 1d83085. The regression test keeps the mapped view for an empty range and still removes it for a non-empty range. Both CI test suites and Clippy passed.

**@⁠TaynanGT** on GitHub · 2026-11-27 19:27 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/351#issuecomment-7226552685) @⁠ahmetbagci8 Merged as `1d83085`. The regression test keeps the mapped view for an empty range and still removes it for a non-empty range. Both CI test suites and Clippy passed.
This discussion has been locked. Commenting is limited to contributors.
No description provided.