[PR #842] [MERGED] xgameruntime: XPersistentLocalStorageGetPath reports the required size on a short buffer (RT-712) #882

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

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/842
Author: @c4k3ss
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @QemmHD

Base: main ← Head: rt/pls-get-path-size


📝 Commits (2)

  • c156e77 xgameruntime: XPersistentLocalStorageGetPath reports the required size on a short buffer (RT-712)
  • d72a0c9 xgameruntime: correct the pls_get_path short-buffer comment

📊 Changes

2 files changed (+12 additions, -3 deletions)

View changed files

📝 runtime/shims/xgameruntime.cpp (+5 -1)
📝 runtime/test/xgameruntime_test.cpp (+7 -2)

📄 Description

Claimed in the coordination issue as: RT-712 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7134292009), carried over from the upstream repository, where it was open and independently tested when the repository went private.

What and why

pls_get_path (XPersistentLocalStorageGetPath, slot 4 of XPersistentLocalStorageImpl in runtime/shims/xgameruntime.cpp) answered a short buffer with ERROR_INSUFFICIENT_BUFFER and *path_used = 0, so a title that passes a small buffer with a non-null used pointer learns nothing about the size it needs. Slot 3 (pls_get_path_size) already reports that size; this makes pls_get_path report it on the short-buffer error too: on a short buffer *path_used is the path length with its NUL, the buffer is untouched and the HRESULT is unchanged. The success path is unchanged.

Tested

runtime/test/xgameruntime_test.cpp, in the existing XPersistentLocalStorageImpl block: the short-buffer case checks used == size (slot 3's answer) and that the two-byte buffer is left alone; a buffer one byte short reports the same size; a null used pointer on a short buffer is tolerated.

  • Windows 11 26200, MSVC 14.44, RelWithDebInfo, Ninja, on main d0da7dade: ctest -R ^xgameruntime$ passes with the change. Negative control (this main's xgameruntime.cpp with the new test): xgameruntime_test: 2 of 160 checks failed, the two new size checks.
  • Upstream, the same change had one independent pass (RTX 2060, Windows 10, clang-cl) including the same negative control.

GPUs tested: n/a (CPU-only shim and test)

AI-assisted: yes (Claude Code); built and tested on the machine above.

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (not a translator change)

🔄 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/842 **Author:** [@c4k3ss](https://github.com/c4k3ss) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@QemmHD](https://github.com/QemmHD) **Base:** `main` ← **Head:** `rt/pls-get-path-size` --- ### 📝 Commits (2) - [`c156e77`](https://github.com/ubiquitarianism/leonida/commit/c156e77c46ed51a378dd55493c42fd914a70ba4d) xgameruntime: XPersistentLocalStorageGetPath reports the required size on a short buffer (RT-712) - [`d72a0c9`](https://github.com/ubiquitarianism/leonida/commit/d72a0c9f50419c80da626afb7fd8f2bccdf7992c) xgameruntime: correct the pls_get_path short-buffer comment ### 📊 Changes **2 files changed** (+12 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `runtime/shims/xgameruntime.cpp` (+5 -1) 📝 `runtime/test/xgameruntime_test.cpp` (+7 -2) </details> ### 📄 Description Claimed in the coordination issue as: RT-712 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7134292009), carried over from the upstream repository, where it was open and independently tested when the repository went private. ### What and why `pls_get_path` (`XPersistentLocalStorageGetPath`, slot 4 of `XPersistentLocalStorageImpl` in `runtime/shims/xgameruntime.cpp`) answered a short buffer with `ERROR_INSUFFICIENT_BUFFER` and `*path_used = 0`, so a title that passes a small buffer with a non-null `used` pointer learns nothing about the size it needs. Slot 3 (`pls_get_path_size`) already reports that size; this makes `pls_get_path` report it on the short-buffer error too: on a short buffer `*path_used` is the path length with its NUL, the buffer is untouched and the `HRESULT` is unchanged. The success path is unchanged. ### Tested `runtime/test/xgameruntime_test.cpp`, in the existing `XPersistentLocalStorageImpl` block: the short-buffer case checks `used == size` (slot 3's answer) and that the two-byte buffer is left alone; a buffer one byte short reports the same size; a null `used` pointer on a short buffer is tolerated. - Windows 11 26200, MSVC 14.44, RelWithDebInfo, Ninja, on `main` `d0da7dade`: `ctest -R ^xgameruntime$` passes with the change. Negative control (this `main`'s `xgameruntime.cpp` with the new test): `xgameruntime_test: 2 of 160 checks failed`, the two new size checks. - Upstream, the same change had one independent pass (RTX 2060, Windows 10, clang-cl) including the same negative control. GPUs tested: n/a (CPU-only shim and test) AI-assisted: yes (Claude Code); built and tested on the machine above. ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (not a translator change) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:19:21 +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#882
No description provided.