gpu: use checked addition and forward-progress guards in committed memory queries #38
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/38"
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 edsuuu/VI-BR-PORT. Originally posted by ahmetbagci8 on 2026-11-29T12:41:39Z.
Problem
In crates/victory-gpu/src/texture.rs (committed_by_query) and crates/victory-gpu/src/port.rs (committed):
ext <= p /
ext <= here), unlike exture::unmapped immediately below committed_by_query, so a zero-size or non-advancing VirtualQuery region would spin indefinitely (and exture::committed_by_query also used unchecked BaseAddress as usize + RegionSize).
Fix
Use checked_add(len) (returning alse on overflow), saturating_add(info.RegionSize), and a
ext <= p /
ext <= here forward-progress guard in both functions, with unit tests (committed_by_query_rejects_overflowing_range and committed_rejects_overflowing_range).
Verification
Imported from edsuuu/VI-BR-PORT. Originally posted by edsuuu on 2026-11-29T13:20:53Z.
Review: APPROVED
Thanks, clean and well tested. It passed our full local CI together with the other fixes of this batch. Merged into
dev, where everything is tested in the game first; it reachesmainwith the next release.