Repository navigation
xgameruntime: XPersistentLocalStorageGetPath reports the required size on a short buffer (RT-712) - #842
Conversation
…e on a short buffer (RT-712) The (size, buffer, used) convention of the XSystem id getters: a short buffer learns the path length with its NUL in *path_used, the buffer stays untouched, the HRESULT is unchanged. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
|
Reviewed An independent differential harness testing the extracted
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 Clean merge-tree against LGTM. |
The XSystem id getters (XSystemGetConsoleId, copy_id) return ERROR_INSUFFICIENT_BUFFER without setting *used, so they are not the precedent the comment named. Say what the code does instead: the buffer is untouched and *path_used gets the path length with its NUL, the value slot 3 (pls_get_path_size) reports. Comment only, no behavior change. Noted by moffington in review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@moffington thanks for the review and the harness run. You're right about the comment: |
|
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 66d4f5a, its ctests pass both plain and with LEONIDA_VK_VALIDATION=1. Cumulative of this batch (13 PRs) on main 0b45fdc: 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 main 6261ca9: 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). |
Claimed in the coordination issue as: RT-712 (#14 (comment)), 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)