Return false on zero-length ranges and avoid overflow in in_shader_heap #438
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
needs-logs
old-names
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/TaynanGT--Vice-Tay!438
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@ahmetbagci8 on GitHub · 2026-11-29 11:25 UTC · original
ahmetbagci8:fix/gpu-in-shader-heap-empty-range→main· +60048 −5429 · 206 files · 660 commits · closed without mergingProblem
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
@TaynanGT on GitHub · 2026-11-29 11:35 UTC · original
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.
@Kal0s-design on GitHub · 2026-11-29 12:58 UTC · original · reviewed
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
@TaynanGT on GitHub · 2026-11-29 19:03 UTC · original
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.
@TaynanGT on GitHub · 2026-11-30 17:07 UTC · original
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