Repository navigation
Conversation
- `inplace::views_gone(at, 0)` evaluated `v.views.range((at + 1)..at)` whenever any view was registered, panicking unconditionally inside `BTreeMap::range` while holding the global `VIEWS` mutex (and across FFI callers of `title_memory_remapped`). - `watch::title_memory_remapped(at, 0)` and `watch::writing(at, 0)` with an unaligned `at` computed `k..(k + 1)`, stripping guard/absent tracking from an untouched block (and `watch::open` panicked if `start > end`). - `watch::on_write` computed `at + 1` inside the `extern "system"` VEH, overflowing/wrapping if `at == usize::MAX`. Guard `len == 0` in `inplace::views_gone`, `inplace::title_memory_freeing`, `watch::title_memory_remapped`, and `watch::writing`, guard `start >= end` in `watch::open`, use `checked_add(1)` in `watch::on_write`, and add synthetic unit tests in both modules.
triippywhale
pushed a commit
to triippywhale/victory-fork
that referenced
this pull request
Nov 25, 2026
…ort of fxceless fxceless#622) views_gone(at, 0) made an inverted BTreeMap range and panicked under the VIEWS mutex; zero-length remaps and writes at an unaligned address opened a block nothing touched; the write handler's at + 1 could overflow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017V7WBCi8h4eymnRhdth77t
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Zero-length ranges and fault-address edge cases in
crates/victory-gpu/src/inplace.rsandcrates/victory-gpu/src/watch.rscould panic insideBTreeMap/BTreeSet::rangeor strip guards from untouched blocks:inplace::views_gone(at, 0)panicked unconditionally wheneverVIEWSwas non-empty: withlen == 0andat < usize::MAX,end == at, sov.views.range(at.saturating_add(1)..end)evaluated(at + 1)..atand panicked while holding the globalVIEWSmutex (and acrossextern "system"FFI callers oftitle_memory_remapped).watch::title_memory_remapped(at, 0)andwatch::writing(at, 0)stripped guards on unaligned addresses:at / BLOCK .. at.div_ceil(BLOCK)evaluates tok..(k + 1)whenatis notBLOCK-aligned, erroneously unguarding/clearing an untouched block (andwatch::openpanicked ifstart > end).watch::on_writecomputedat + 1unchecked inside theextern "system"VEH, overflowing/wrapping ifat == usize::MAX.Fix
len == 0ininplace::views_gone,inplace::title_memory_freeing,watch::title_memory_remapped, andwatch::writing(and usebase.saturating_add(view.0)inviews_gone).start >= endinwatch::open, and useat.checked_add(1)inwatch::on_write.views_gone_ignores_zero_length_without_panickingandzero_length_remap_and_writing_do_not_panic_or_unguard.Verification
cargo test -p victory-gpu --locked inplace:: -- --test-threads=1: 7 passed, 0 failedcargo test -p victory-gpu --locked watch:: -- --test-threads=1: 8 passed, 0 failedcargo xtask policy: 169 files okcargo clippy -p victory-gpu --all-targets --all-features --locked -- -D warnings: clean (default-features build onc96b4f2has only the pre-existingdead_codewarning onplaced_filler_twins, tracked in GPU: keep clippy green without the diagnostics feature #491)(AI-assisted; synthetic unit tests only, no game data.)