[PR #1134] [CLOSED] d3d12_xs: validate pCount in detached GetFrameStatisticsX (RT-XS-FRAME-STATS-NULL-COUNT) #1167

Closed
opened 2026-11-26 20:20:18 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1134
Author: @Taffyyy-ops
Created: 11/24/2026
Status: ❌ Closed

Base: main ← Head: fix/xs-frame-stats-null-count


📝 Commits (1)

  • 97c9807 d3d12_xs: validate pCount in detached GetFrameStatisticsX (RT-XS-FRAME-STATS-NULL-COUNT)

📊 Changes

2 files changed (+34 additions, -6 deletions)

View changed files

📝 runtime/shims/d3d12_xs_device.cpp (+6 -3)
📝 runtime/test/xs_proxy_mock_test.cpp (+28 -3)

📄 Description

Item ID: RT-XS-FRAME-STATS-NULL-COUNT (#14 claim: https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7141449898)

Summary

  • Align the detached GetFrameStatisticsX fallback (Slot == routes.frame_statistics, default device slot 81) in runtime/shims/d3d12_xs_device.cpp with FramePacer::get_frame_statistics (runtime/src/frame_pacer.h): when pCount (a3) is nullptr, return E_INVALIDARG instead of S_FALSE (without forwarding to PC slot 81 ID3D12Device13::OpenExistingHeapFromAddress1).
  • Keep returning S_FALSE and zeroing *pCount when pCount != nullptr (including when pStats / a4 is nullptr), matching FramePacer::get_frame_statistics.
  • Left docs/d3d12_vulkan.md and docs/d3d12_xs_surface.md untouched (neither states unattached S_FALSE on null pCount, and leaving docs untouched avoids conflicting with #1125).
  • Updated runtime/test/xs_proxy_mock_test.cpp (run_env_slots invalid-env case and check_presentation_wiring) with synthetic regression tests covering detached and partial-handler (get_frame_statistics == nullptr) calls with null/non-null pCount and sentinel out buffers, verifying mock->calls[81] == 0.

Testing & Verification

AI-assisted: yes (no game files, LEONIDA_GAME_DIR and LEONIDA_MOVIE unset).
Environment: Windows 11, MSVC 19.44 + Ninja, NVIDIA GeForce RTX 5060 Laptop GPU (driver 621.24), WARP.

  • Build: cmake --build runtime/build -> 0 errors, 0 new /W4 warnings on d3d12_xs_device.cpp or xs_proxy_mock_test.cpp.
  • CTest (ctest --test-dir runtime/build --output-on-failure -R "^(xs_proxy_mock|device_proxy|frame_pacer|xbox_present)"): 11/11 passed (xbox_present_readback_size, device_proxy, device_proxy_trace, xs_proxy_mock, xs_proxy_mock_no_reserve, xs_proxy_mock_no_protect, xs_proxy_mock_no_handler, xs_proxy_mock_env_slots, xs_proxy_mock_env_slots_invalid, xbox_present on NVIDIA GeForce RTX 5060 Laptop GPU, frame_pacer).
  • python -I tests/test_ctest_registration.py: 4/4 OK.
  • python -I scripts/check_no_game_data.py runtime/shims/d3d12_xs_device.cpp runtime/test/xs_proxy_mock_test.cpp: exited 0.
  • git diff --check: clean.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1134 **Author:** [@Taffyyy-ops](https://github.com/Taffyyy-ops) **Created:** 11/24/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/xs-frame-stats-null-count` --- ### 📝 Commits (1) - [`97c9807`](https://github.com/ubiquitarianism/leonida/commit/97c9807037b67f8231fff9007e0b4a479c9b7016) d3d12_xs: validate pCount in detached GetFrameStatisticsX (RT-XS-FRAME-STATS-NULL-COUNT) ### 📊 Changes **2 files changed** (+34 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `runtime/shims/d3d12_xs_device.cpp` (+6 -3) 📝 `runtime/test/xs_proxy_mock_test.cpp` (+28 -3) </details> ### 📄 Description Item ID: `RT-XS-FRAME-STATS-NULL-COUNT` (#14 claim: https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7141449898) ### Summary - Align the detached `GetFrameStatisticsX` fallback (`Slot == routes.frame_statistics`, default device slot `81`) in `runtime/shims/d3d12_xs_device.cpp` with `FramePacer::get_frame_statistics` (`runtime/src/frame_pacer.h`): when `pCount` (`a3`) is `nullptr`, return `E_INVALIDARG` instead of `S_FALSE` (without forwarding to PC slot 81 `ID3D12Device13::OpenExistingHeapFromAddress1`). - Keep returning `S_FALSE` and zeroing `*pCount` when `pCount != nullptr` (including when `pStats` / `a4` is `nullptr`), matching `FramePacer::get_frame_statistics`. - Left `docs/d3d12_vulkan.md` and `docs/d3d12_xs_surface.md` untouched (neither states unattached `S_FALSE` on null `pCount`, and leaving docs untouched avoids conflicting with #1125). - Updated `runtime/test/xs_proxy_mock_test.cpp` (`run_env_slots` invalid-env case and `check_presentation_wiring`) with synthetic regression tests covering detached and partial-handler (`get_frame_statistics == nullptr`) calls with null/non-null `pCount` and sentinel `out` buffers, verifying `mock->calls[81] == 0`. ### Testing & Verification AI-assisted: yes (no game files, `LEONIDA_GAME_DIR` and `LEONIDA_MOVIE` unset). Environment: Windows 11, MSVC 19.44 + Ninja, NVIDIA GeForce RTX 5060 Laptop GPU (driver `621.24`), WARP. - Build: `cmake --build runtime/build` -> 0 errors, 0 new `/W4` warnings on `d3d12_xs_device.cpp` or `xs_proxy_mock_test.cpp`. - CTest (`ctest --test-dir runtime/build --output-on-failure -R "^(xs_proxy_mock|device_proxy|frame_pacer|xbox_present)"`): **11/11 passed** (`xbox_present_readback_size`, `device_proxy`, `device_proxy_trace`, `xs_proxy_mock`, `xs_proxy_mock_no_reserve`, `xs_proxy_mock_no_protect`, `xs_proxy_mock_no_handler`, `xs_proxy_mock_env_slots`, `xs_proxy_mock_env_slots_invalid`, `xbox_present` on `NVIDIA GeForce RTX 5060 Laptop GPU`, `frame_pacer`). - `python -I tests/test_ctest_registration.py`: 4/4 OK. - `python -I scripts/check_no_game_data.py runtime/shims/d3d12_xs_device.cpp runtime/test/xs_proxy_mock_test.cpp`: exited 0. - `git diff --check`: clean. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:20:18 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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
starred/leonida#1167
No description provided.