xgameruntime: XPersistentLocalStorageGetPath reports the required size on a short buffer (RT-712) #842
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!842
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/842/head"
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?
@c4k3ss on GitHub · 2026-11-24 14:27 UTC · original
c4k3ss:rt/pls-get-path-size→main· +12 −3 · 2 files · 2 commits · merged 2026-11-24 21:26 UTCClaimed in the coordination issue as: RT-712 (#14), 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 ofXPersistentLocalStorageImplinruntime/shims/xgameruntime.cpp) answered a short buffer withERROR_INSUFFICIENT_BUFFERand*path_used = 0, so a title that passes a small buffer with a non-nullusedpointer learns nothing about the size it needs. Slot 3 (pls_get_path_size) already reports that size; this makespls_get_pathreport it on the short-buffer error too: on a short buffer*path_usedis the path length with its NUL, the buffer is untouched and theHRESULTis unchanged. The success path is unchanged.Tested
runtime/test/xgameruntime_test.cpp, in the existingXPersistentLocalStorageImplblock: the short-buffer case checksused == size(slot 3's answer) and that the two-byte buffer is left alone; a buffer one byte short reports the same size; a nullusedpointer on a short buffer is tolerated.maind0da7dade:ctest -R ^xgameruntime$passes with the change. Negative control (thismain'sxgameruntime.cppwith the new test):xgameruntime_test: 2 of 160 checks failed, the two new size checks.GPUs tested: n/a (CPU-only shim and test)
AI-assisted: yes (Claude Code); built and tested on the machine above.
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (not a translator change)@moffington on GitHub · 2026-11-24 15:43 UTC · original
Reviewed
c156e77c4againstd0da7dadeon Linux.An independent differential harness testing the extracted
pls_get_pathandpls_get_path_sizefunctions with ASan/UBSan and guard pages produced:Verified required-size reporting, NUL termination, zero-length/undersized buffers, null pointers, and no unintended buffer writes.
Minor non-blocking note: the comment about XSystem ID getters reporting the required size on insufficient buffers appears inaccurate. Neither
XSystemGetConsoleIdnorcopy_idcurrently does this.Clean merge-tree against
a28927849. Full Windows runtime tests were not run locally due to the existing MinGW SEH compilation issue.LGTM.
@c4k3ss on GitHub · 2026-11-24 17:55 UTC · original
@moffington thanks for the review and the harness run. You're right about the comment:
XSystemGetConsoleIdandcopy_idreturnERROR_INSUFFICIENT_BUFFERwithout setting*used, so they weren't the precedent it named. Fixed ind72a0c9f5(comment only, no behavior change). It now says what the code does: the short buffer is left untouched and*path_usedgets the path length with its NUL, the value slot 3 reports. I corrected the same claim in the PR description.@QemmHD on GitHub · 2026-11-24 21:26 UTC · original
Merging.
Why merged: RT-712: XPersistentLocalStorageGetPath reports the required size on a short buffer and leaves the buffer untouched, as the GDK documents. moffington's ASan/UBSan harness passes 26/26, and their comment nit is fixed.
Why it's good: There are no writes into the caller's buffer on that path. xgameruntime passes both plain and under validation.
Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Merged alone onto main
66d4f5aa3, its ctests pass both plain and with LEONIDA_VK_VALIDATION=1. Cumulative of this batch (13 PRs) on main0b45fdc21: the repo-consistency set gives 573 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 314/316 with the same 11 skips. The only failures are main's: d3d12_depth_resolve (pre-existing) and d3d12_close_parity (the #510 regression, fixed by #1286). All d3d12_* tests under validation show 0 VUIDs. git merge-tree against current main6261ca916: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes.AI-assisted (Claude Code, Claude Opus 5.5).