Return false on zero-length ranges and avoid overflow in in_shader_heap #438
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/438"
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 TaynanGT/Vice-Tay. Originally posted by ahmetbagci8 on 2026-11-29T11:25:43Z.
Problem
In crates/victory-gpu/src/descriptor.rs, in_shader_heap(at, len) computes:
ust let (from, to) = (at as u64, at as u64 + len as u64); SHADER_HEAPS.read().unwrap_or_else(|e| e.into_inner()).iter().any(|&(start, end, _)| from < end && start < to)Fix
Return alse early when len == 0 and compute o with saturating_add. Added unit test in_shader_heap_rejects_empty_ranges_and_saturates_length.
Verification
Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-29T11:35:20Z.
Thanks for catching the empty-range case. Please include a boundary test near u64::MAX as well as a normal overlapping and non-overlapping range, so the saturation behavior is explicit. The reported descriptor suite is useful.
Imported from TaynanGT/Vice-Tay. Originally posted by Kal0s-design on 2026-11-29T12:58:00Z.
Review: COMMENTED
Ran this on Windows.
cargo test -p victory-gpu --libgives 528 passed (the descriptor group is 76), andcargo clippy -p victory-gpu --all-targets -D warningsis clean. With the old line put back, the new test fails on!in_shader_heap(address + 32, 0).The two callers in
host.rs(around 9275 and 9314) pass a copy's destination and length. A zero-length copy writes nothing, so answering false for it changes nothing there, and it now matchesany_in_shader_heap.AI-assisted: yes
Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-29T19:03:57Z.
Thanks for the native regression run. I checked the diff: the new test covers an overlapping range, zero-length ranges, a saturating length, and an address at usize::MAX. The zero-length behavior is consistent with a copy that writes nothing. This is the narrow fix I wanted.
Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-30T17:07:01Z.
mainhas moved to a new line of the code and everything is now named Vice-Tay, so this PR no longer applies as it is (details in #468). If you'd like this change in, please rebuild it on the currentmainand open a new PR; I'll review it there.Pull request closed