feat(libSceJxr): implement PKAlloc #14425
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/14425"
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 AlexWhitehouse on 2026-11-01T12:26:24Z.
What
Implements
PKAlloc(NIDIXOD4hTCNU0) in libSceJxr, ported from jxrlibJXRGlue.cat the commit the debt file and3rdparty/jxrlibpin.cbzeroed bytes with the guestcalloc(1, cb), the same application heapPKFreealready frees to.ppv, NULL on failure included, and returnsWMP_errSuccess(0) orWMP_errOutOfMemory(-101), withERRa signed 64-bit value as in the pinned headers.cbfollows the guestcalloc(1, 0).ppv, which upstream dereferences, throws.src/Allocation.cppstarts with the Microsoft copyright and licence notice fromJXRGlue.c, lines 1-27. Upstream stores that file in Windows-1252, so the notice is converted to UTF-8 (iconv -f WINDOWS-1252): the copyright sign and the two bullet characters change encoding and the text is unchanged. The repository accepts UTF-8 text only.The debt file gets a Functional entry, and the additional-export count goes from 132 to 131.
Tested
tests/GuestJxr.cpp(ctestguest_jxr) now coversPKAllocthrough the existing replacement-heap hooks:calloc(1, size)call per allocation, for sizes 1, 257, 4097 and 0;ppv;PKFree;ppvthrowing.mainthe test fails withPKAlloc_nid_postfix not implemented.GuestJxr.cpp:94. The restored code passes.ctest --test-dir build-full -R jxr: 9/9 passed.-R 'jxr|public_headers': 74/74 passed.python3 tools/check_conventions.py --base origin/main: all conventions checks passed.python3 tools/pr_overlap.py --branch feat/libscejxr-pkalloc: no overlap with open pull requests.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T12:43:17Z.
Review: COMMENTED
Reviewed — no blocking findings
The
PKAllocport matches jxrlib'scalloc(1, cb)behaviour and its out-of-memory return code at the pinned commit, and the test pins the allocation, zeroing, failure and null cases; the only issue is three trailing spaces in the copied licence header, which is non-blocking. I found no blocking issue at9719c64df6.What I ran
Exact head
9719c64df6c37282b47e64f6a2c991646891511b; PR baseba627802e2210187d417deb64c8f2fed8e33011f(currentmain), unchanged at completion. No build and no test run. Commands:The precheck's ABI and test-quality helpers were missing from the isolated head tree, so both were run by hand from
/marc/AnyPS5/tools. I also compared the port with jxrlib atf7521879862b9085318e814c6157490dd9dbbdb4:jxrgluelib/JXRGlue.cL46-L50,image/sys/windowsmediaphoto.hL226 (WMP_errOutOfMemory -101) and L243 (typedef long ERR).Results
//lines of the copied licence header incore/libs/prx/libSceJxr/src/Allocation.cpp(lines 5, 8 and 14); non-blocking, see belowpossible-unregistered-cpp-testfinding; false positive, because the test is registered asguest_jxr_testsincore/libs/prx/libSceJxr/CMakeLists.txtL49calloc(1, cb)), zero-size behaviour and return codesFindings
Blocking: none.
Non-blocking:
//lines in the licence header carry a trailing space, whichgit diff --checkreports. Stripping those spaces makes the diff check pass; nothing else in the file is affected.What I read:
PKAllocinAllocation.cpp, the new test incore/libs/tests/GuestJxr.cpp(the allocation hook is wrapped so each call is counted, zeroed memory is checked, and failure and null-ppvcases are covered), and the debt entry, whose count goes from 132 to 131 and matches the 135 to 134 declarations inExport.cpp.Not verified
ctest guest_jxr9/9 on Ubuntu and a mutation check; I did not reproduce them.To get this to a good state
Optional: strip the trailing spaces on the three licence lines so
git diff --checkis clean. No other change is needed.