fix(libSceNpUniversalDataSystem): copy record keys, string values and binary values through checked reads #20812
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/20812"
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?
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-11-15T15:59:01Z.
What
The
IntRecord*builders inRecord.cppread guest strings and bytes in place: object keys (key[0], thenstd::string_view(key)insideSet), theIntRecord*SetStringvalues (std::string(value)), theIntCreateRecordDatarecord type, and theIntRecord*SetBinarybytes (Uds::Binary(bytes, bytes + size)). An unmapped key, value or byte buffer faulted the host.What changes
CopyGuestString_nid_no_patchbefore use.SIZE_MAX, because the direct read had no length limit and this keeps that. That relies on #20678, which growsCopyGuestString's buffer one page at a time instead of allocating the cap up front, so this PR depends on it.key = name.c_str(), the same patternsigaltstackuses forstack). TheSetcalls are therefore unchanged.Uds::Binaryvector with oneGuestCopyIn_nid_no_patch.Errors
0x80553114, an unreadable record type0x8055310Dand an unreadable value0x80553115. These are the codes a null one already returns, and nothing is stored.0x80553101, the file's out-of-memory code.Relation to #19606
#19606 (gnavarro24) covers this file's other guest pointers: the
IntInitializeparameter, the record-handle outputs and thevalue_ptroutputs. This PR leaves all of those to it and touches none of the lines it changes.The debt entry goes in a fragment under
docs/dev/debt/changes/and marks these codes as host-safety fallbacks. Console behaviour here is not measured.Tested
Linux (Ubuntu 26.04.1), GCC 15.2, Release.
guest_np_uds_records, new cases:0x10) inputs return the codes above witherrnoleft at 71, and the array and object sizes are unchanged afterwards:CreateRecordDatarecord type;SetBool,SetObjectandSetArray.libSceNpUniversalDataSystemtests pass:np_uds_events,guest_np_trophy_unlocks,guest_np_trophy_data,guest_np_trophy_stats,guest_np_uds_recordsandguest_np_uds_queries.Record.cppfrommainwith these tests dies with SIGSEGV at address0x10. The long-key case runs first and passes onmaintoo.git merge-treeis clean againstmain, #19606 and #13606, the open PRs touching this library.debt_fold.py --checkpass.tools/check_conventions.pypasses on the branch and this body.c588fe39bamerged intomain56c87adbdc(Windows 11, i7-12700K, WinLibs GCC 15.2.0, Release):guest_copy_guest_string,guest_np_uds_records, pass 2/2, three runs.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Pull request closed