Fix #2413: use saturating_add for view end bounds in aliases #3017
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!3017
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3017"
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?
@tharun-37 on GitHub · 2026-11-26 03:29 UTC · original
tharun-37:fix/xmem-saturating-add→main· +37 −2 · 1 files · 1 commits · closed without mergingFix #2413: use saturating_add for view end bounds in aliases
In xmem::aliases, end uses saturating_add but the view-range checks used unchecked addition (*base + size, base + size), which can overflow/panic. Use saturating_add consistently.
Additionally:
541938dc11to73227f823b@futurepro62 on GitHub · 2026-11-26 03:47 UTC · original
Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head
541938d(on its base940d32f).Tested
dxil.dllfrom Windows SDK 10.0.26100 (the loader's default), debug.cargo build --workspace --locked, thencargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 696 passed, 0 failed, 10 ignored.#[test]functions in the diff.--skipleaves out tests that fail on main63bcca4on this card too, not because of this PR:heap_direct_texture_reads_mark_their_heap_indexends thevictory-shadertest process with0xc0000005(#2571), so without the skip the rest of that crate never reports;dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_viewsand the twostride_testshit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317);gathers_at_a_level_match_the_hardwarefails on lane 0 (#1744).Not tested
AI use
@Marvisak on GitHub · 2026-11-26 06:15 UTC · original · edited 2026-11-26 07:19 UTC
Automated triage for the maintainers.
Thanks for the reply and for updating the description. The head is unchanged, and you agree the guards in
xmem.rs::aliasesfix no reachable case, so the proposed close stands. The PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the labeltriage: proposed close.Generated by Claude Code
@tharun-37 on GitHub · 2026-11-26 06:18 UTC · original
Removed the decompiled-code attribution from the description per the asset policy.
On the first point: you're right that liases has no real caller on main except its own test, so these guards fix no live bug today. The saturating_add change is still correct defensive hygiene (the original code could panic on usize::MAX inputs), but I agree the early-return and tests are mostly defensive. If you'd prefer to close this and land just the core saturating_add one-liner as #90 already does in larger PRs (#1017, #39, #523, #1241), I'm fine with that — closing #3017.
@fuzeofficlal on GitHub · 2026-11-26 03:43 UTC · original · requested changes
Code review on
541938dc(static source inspection):emit/lower.rs(med3/nan_safe_min/nan_safe_max) changes bundled in this PR:crates/victory-shader/src/emit/lower.rs:2266-2295in addition toxmem.rs, which is unrelated to#2413(aliasesview end bounds) and appears to come from a separate branch/base. Please drop thelower.rshunk and rebase onto currentmain.aliasesstill panics on empty (len == 0) queries (crates/victory-hle/src/modules/xmem.rs:405-419):len == 0(e.g.,aliases(0x10000, 0, &mut out)),end == at, sophysical.views.range(at.saturating_add(1)..end)passes a reversed range (0x10001..0x10000) toBTreeMap::rangeand panics. Returning early whenend <= at(and adding a unit test for both empty and overflowing queries) completes the bounds fix.@kotekompotek on GitHub · 2026-11-26 04:37 UTC · original · approved these changes
LGTM on the fix itself (end<=at early-out, saturating_add on both bound comparisons, boundary tests all discriminate). Heads-up: #3037 contains this identical xmem/aliases change plus its write-watch fix — whichever merges second gets a conflict; may be worth rebasing one onto the other.
@tharun-37 on GitHub · 2026-11-26 09:57 UTC · original
Closing to focus on new issues
Pull request closed