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

Closed
github-bot wants to merge 1 commit from gh-pr/2526/head into gh-pr/2526/base
Owner

@⁠reeledMarek on GitHub · 2026-11-25 15:16 UTC · original
reeledMarek:fix/hle-xg-tiling-null-out → main · +42 −21 · 1 files · 1 commits · closed without merging

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.
**@⁠reeledMarek** on GitHub · 2026-11-25 15:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/2526) `reeledMarek:fix/hle-xg-tiling-null-out` → `main` · +42 −21 · 1 files · 1 commits · closed without merging ### 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:08:15 +00:00
github-bot closed this pull request 2026-11-26 05:08:15 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 15:55 UTC · original

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

**@⁠Marvisak** on GitHub · 2026-11-25 15:55 UTC · [original](https://github.com/Marvisak/VIctory/pull/2526#issuecomment-7167433950) <!-- 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)_
Author
Owner

@⁠reeledMarek on GitHub · 2026-11-25 20:05 UTC · original

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

**@⁠reeledMarek** on GitHub · 2026-11-25 20:05 UTC · [original](https://github.com/Marvisak/VIctory/pull/2526#issuecomment-7173179625) Closing per triage — checked D3D12 `GetResourceTiling` documentation and confirmed there is no documented null-array count query mode. Thanks for the review!

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2526
No description provided.