GPU/inplace+watch: guard zero-length ranges and VEH fault overflow #622
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from fxceless/victory-fork. Originally posted by AscilCH on 2026-11-25T03:25:58Z.
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 #491)(AI-assisted; synthetic unit tests only, no game data.)
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.