GPU/inplace+watch: guard zero-length ranges and VEH fault overflow #622
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!622
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-622"
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?
@AscilCH on GitHub · 2026-11-25 03:25 UTC · original
AscilCH:fix/gpu-inplace-and-watch-zero-len-panic-and-overflow→main· +90 −4 · 2 files · 1 commits · openProblem
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 #491)(AI-assisted; synthetic unit tests only, no game data.)
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.