hle: reject null tiling out when the count is nonzero #3172
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!3172
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3172"
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?
@cloph-dsp on GitHub · 2026-11-26 10:57 UTC · original
cloph-dsp:fix/xg-null-out-count→main· +39 −1 · 1 files · 1 commits · openDepends on: #1633 (claim
XG-NULL-OUT-COUNT).XGTextureAddressComputer::GetResourceTilingdereferencedoutfor every requested subresource while only the count pointer was checked. A caller asking for a nonzero count with a nullouttherefore faulted. The function now rejects that combination withE_INVALIDARGbefore writing any output.Test:
modules::xg::tests::tiling_rejects_null_out_when_count_nonzerouses a synthetic texture computer and a nulloutpointer.Validation (Windows, Rust 1.100.0/MSVC, worktree-local
CARGO_TARGET_DIR):cargo test --locked -p victory-hle --lib modules::xg::tests::tiling_rejects_null_out_when_count_nonzero— 1 passed, 0 failed.cargo test --locked -p victory-hle --lib modules::xg::— 5 passed, 0 failed.git diff --check— clean.AI-assisted (Hy4 flash). Synthetic inputs only; no game assets, extracted shaders, logs or DRM material were used or uploaded.
@AurumCarlos on GitHub · 2026-11-26 12:12 UTC · original · reviewed
The crash is real and the guard fixes it: on
main,out.add(i).write(..)runs on a nulloutas soon aswanted > 0. Returning before any output is written also matches what the description says. Two remarks:1. The guard is broader than the writes it protects. It rejects
*count > 0, but the loop only writes whenwanted = (standard * slices).saturating_sub(first).min(*n)is nonzero. Calls that never touchedoutonmainnow fail withE_INVALIDARGwhere they used to returnS_OKand set*count = 0. That covers afirstpast the last standard subresource, and a texture that is all mip tail (standard == 0). If the console's XG really rejects any nulloutwith a nonzero count, then this is the right behaviour, but the PR doesn't say where that comes from. If it isn't known, checkingwanted > 0instead (moving the check afterwantedis computed, but before anything is written) would fix the crash without changing any call that works today.2. The test only covers the rejected case. The title says "when the count is nonzero", so it would be worth pinning the cases that must still succeed with a null
out:*count == 0→S_OK,*countstays 0;count→S_OK, withtiles/packed/shapestill filled in.It might also be worth asserting that
tiles/packed/shapeare left untouched after theE_INVALIDARG, since "before writing any output" is part of the stated behaviour.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.