feat(libSceLibcInternal): implement num_get pointer parsing #24723
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/24723"
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 paulk161 on 2026-11-21T00:18:56Z.
What
Implement classic
libSceLibcInternalnum_get<char>pointer extraction (get/do_getforvoid*, NIDmy9ujasm6-0through the facet vtable).The field is always parsed as hexadecimal, independent of the stream's basefield, with an optional
0x/0Xprefix, following the existingstd::__sce_v2pointer extraction. A conversion failure or a value aboveuintptr_tstores a null pointer and setsfailbit; bad grouping keeps the value and setsfailbit; reaching the end addseofbit. Guesterrnois preserved.The technical-debt fragment now records pointer extraction as implemented. This edits the same debt sentence as #24520 (bool extraction); whichever lands second only needs that sentence rebased.
Tested
Windows 11, MSYS2 UCRT64:
guest_libc_internal_num_get_testsandguest_libc_internal_num_get_do_get_testsguest_libc_internal_num_getandguest_libc_internal_num_get_do_getgetand a facet fromnum_get<char>::_Getcat: hexadecimal under a decimal stream,0xprefix stopping before trailing text, no digits, a bare prefix, and overflow aboveuintptr_tgit diff --check,tools/debt_fold.py --checktools/pr_overlap.py: no overlap with open pull requestsChecklist
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)Summary by CodeRabbit
0xprefix. Parsing works regardless of the stream’s base setting and stops at trailing text.Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-21T00:42:30Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
a237185a51:tools/check_conventions.pypassed.guest_libc_internal_num_get_do_get_testsbuilt cleanly.guest_libc_internal_num_get_do_get):core/libs/prx/libSceLibcInternal/NumGet.cppreverted tomainand the new tests kept, the suite fails: Restoring the change makes it pass again.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T00:42:51Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; one optional test coverage point is listed below.
What I ran
Reviewed head
a237185a51af2e6df0467d77e95d7a8c1149cce2againstmain. No commands or tests were run; the prepared artifacts and source were inspected throughrepo_read.py.Results
Negative control
Not run; no test execution environment was available through the provided reader tools.
Findings
Blocking
None.
Non-blocking
failbitis set, matching the stated behavior. The implementation follows the nearby integer parsing pattern for grouping failure. See NumGet.cpp at the reviewed head.Sources
Not verified
The author-reported Windows 11/MSYS2 UCRT64 builds and runs,
git diff --check, debt check, and overlap check were not independently verified. All three changed files were read at their changed lines and relevant helper/caller context. No changed files were excluded by the manifest;files.jsonwas not available through the reader.To get this to a good state
Nothing is required. Optional: add a bad-grouping test that checks both
failbitand value retention.Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-21T06:25:45Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
a36eb97506:tools/check_conventions.pypassed.guest_libc_internal_num_get_do_get_testsbuilt cleanly.guest_libc_internal_num_get_do_get):core/libs/prx/libSceLibcInternal/NumGet.cppreverted tomainand the new tests kept, the suite fails: Restoring the change makes it pass again.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T06:27:49Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the implementation and tests cover the stated pointer parsing behavior, and the read code shows no verified defect.
What I ran
Reviewed head
a36eb975060729043d939740549c5d58c093b738. No test or build commands were run; repository content was accessed throughrepo_read.py’s review reader. The changed files and relevant integer parsing helpers were read.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
Build and test results reported in the PR description were not independently run. Console behavior and the
num_getvtable slot order are not verified against console firmware. Files read:core/libs/prx/libSceLibcInternal/NumGet.cpp,core/libs/tests/GuestLibcInternalNumGetDoGet.cpp,docs/dev/debt/changes/feat-libcinternal-num-get-do-get.md, andcore/libs/prx/libc/src/DinkumwareInternals.cpp. No changed files were excluded;files.jsonwas unavailable as a standalone review document, and the manifest lists all three changed files as included.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-28T14:17:52Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: reject parsed pointer values that exceed
uintptr_tbefore converting them to a pointer.What I ran
Reviewed head
b327c573407ffb2baef41a4be2d5602a8d275ee6usingrepo_read.pyto inspect the prepared review bundle and targeted source ranges. No build or test commands were run.Results
Findings
Blocking
core/libs/prx/libSceLibcInternal/NumGet.cpp:828converts the parsedunsigned long longdirectly touintptr_twithout checking whether it fits. On a target whereuintptr_tis narrower thanunsigned long long, an input aboveUINTPTR_MAXcan be truncated and accepted as a different pointer value. Reject values abovestd::numeric_limits<std::uintptr_t>::max()and setfailbitwith a null pointer, as the description promises.Non-blocking
None.
Not verified
core/libs/prx/libSceLibcInternal/NumGet.cpp,core/libs/tests/GuestLibcInternalNumGetDoGet.cpp, anddocs/dev/debt/changes/feat-libcinternal-num-get-do-get.md. No changed files were excluded inmanifest.json.To get this to a good state
Add an explicit
uintptr_trange check before the cast, then rerun the pointer parsing tests and build on the updated head.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-28T22:54:41Z.
Review: APPROVED
Reviewed — looks good
The pointer extraction implementation matches the described hexadecimal parsing behavior, and the inspected changed files show no verified blocking defect.
What I ran
Reviewed head
1c0fce7b2f1d1bb3d8bd4d5a537f6958867470e6using the prepared diff andrepo_read.py; no build or tests were run by me.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
No files were excluded from the changed-file manifest. I read the full contents of
core/libs/prx/libSceLibcInternal/NumGet.cppandcore/libs/tests/GuestLibcInternalNumGetDoGet.cpponly in targeted ranges, not in full; I read the complete diff and manifest. Console behavior, builds, and tests were not independently verified.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by Plyxen on 2026-12-03T14:10:20Z.
Review: APPROVED
I read the diff at
1c0fce7b2f. Windows 11 with GCC 15.2 and Linux (Ubuntu 24.04 in WSL2, GCC 13.3), merged intomainat6c6b29320fetogether with other open PRs (so not an isolated build).guest_libc_internal_num_get_do_get: pass on both.main's, the same test fails too.Not checked: a title.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T15:10:54Z.
Review: COMMENTED
Could you coordinate this with #24748 before merging? Both PRs replace the same pointer slot and update the same tests and debt fragment. #24748 also binds the direct
do_get(void**)export. Applying both changes independently would duplicate the shared implementation.I ran
guest_libc_internal_num_get_do_geton Linux with this patch applied. It passed, including the vtable extraction cases for hexadecimal input, a bare prefix, and overflow.AI-assisted: yes.