HLE: avoid null pointer dereference in XG GetResourceTiling count queries #2524

Closed
reeledMarek wants to merge 1 commit from upstream-pr/2526 into main
reeledMarek commented 2026-11-25 15:16:43 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by reeledMarek on 2026-11-25T15:16:43Z.


Problem

In xg::tiling (GetResourceTiling), when count is non-null (*count > 0) and out is null (the standard count-query call pattern), the loop unconditionally dereferenced out.add(i).write(entry), causing an immediate null-pointer write crash.

Fix

  • Check out.is_null(): when null, write the available subresource tiling count to *count and return S_OK without dereferencing out.

Testing

  • Added a null-out count-query assertion to the existing tiling test in crates/victory-hle/src/modules/xg.rs.
  • Verified cargo test -p xtask --locked passes asset policy.
<!-- greyfinch-sync:Marvisak/VIctory:issue:6607729358 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2526). Originally posted by [reeledMarek](https://github.com/reeledMarek) on 2026-11-25T15:16:43Z. --- ### Problem In `xg::tiling` (`GetResourceTiling`), when `count` is non-null (`*count > 0`) and `out` is null (the standard count-query call pattern), the loop unconditionally dereferenced `out.add(i).write(entry)`, causing an immediate null-pointer write crash. ### Fix - Check `out.is_null()`: when null, write the available subresource tiling count to `*count` and return `S_OK` without dereferencing `out`. ### Testing - Added a null-`out` count-query assertion to the existing tiling test in `crates/victory-hle/src/modules/xg.rs`. - Verified `cargo test -p xtask --locked` passes asset policy.
Marvisak commented 2026-11-25 16:09:28 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T15:55:28Z.


Automated triage for the maintainers. Needs work.

The PR makes tiling in crates/victory-hle/src/modules/xg.rs treat a null out with a non-null count as a count query that returns the number of available entries. That is new runtime behaviour, and the PR gives no evidence for it: the code on main documents out as having room for *count entries, and the equivalent host D3D12 GetResourceTiling documents no null-array count query. The added test asserts the new behaviour rather than a known one. What would move this forward: evidence that the title (or the real library) calls this with a null array and expects the count back, such as the call site in the title's code or public documentation. Without that, this is a guard for a call that does not happen. CI: the check job passes.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7167433950 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2526#issuecomment-7167433950). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T15:55:28Z. --- <!-- victory-triage v1 head=3a8b8770261830104b9e06531155821c7f3485b1 verdict=needs-work at=2026-11-25T15:55:21Z --> Automated triage for the maintainers. Needs work. The PR makes `tiling` in crates/victory-hle/src/modules/xg.rs treat a null `out` with a non-null `count` as a count query that returns the number of available entries. That is new runtime behaviour, and the PR gives no evidence for it: the code on main documents `out` as having room for `*count` entries, and the equivalent host D3D12 `GetResourceTiling` documents no null-array count query. The added test asserts the new behaviour rather than a known one. What would move this forward: evidence that the title (or the real library) calls this with a null array and expects the count back, such as the call site in the title's code or public documentation. Without that, this is a guard for a call that does not happen. CI: the `check` job passes. --- _Generated by [Claude Code](https://claude.ai/code)_
reeledMarek commented 2026-11-25 20:06:29 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by reeledMarek on 2026-11-25T20:05:34Z.


Closing per triage — checked D3D12 GetResourceTiling documentation and confirmed there is no documented null-array count query mode. Thanks for the review!

<!-- greyfinch-sync:Marvisak/VIctory:comment:7173179625 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2526#issuecomment-7173179625). Originally posted by [reeledMarek](https://github.com/reeledMarek) on 2026-11-25T20:05:34Z. --- Closing per triage — checked D3D12 `GetResourceTiling` documentation and confirmed there is no documented null-array count query mode. Thanks for the review!
upstream-sync closed this pull request 2026-11-25 21:02:32 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!2524
No description provided.