fix(libSceJson2): reject a null allocParam in the legacy RTTI constructor #16344
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/16344"
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 MarcZX10 on 2026-11-06T10:17:13Z.
What
The legacy
sce::Json::InitParameterRtticonstructor (_ZN3sce4Json17InitParameterRttiC1EPNS0_14AllocParamRttiEPvm) dereferencedallocParamwithout a null check when no module was active, so a guest passingnullptrcrashed the host process. The siblingsetAllocatorRttialready returns early on a null argument; the constructor now does the same after clearing the 24-byte parameter block, which it already did before any other check.fix(libSceJson2): reject a null allocParam in the legacy RTTI constructor: one early return inExport.cpp.test(libSceJson2): cover a null allocParam in the legacy RTTI constructor: with no active module, the constructor called withnullptrmust clear exactly its 24-byte base and leave the trailing bytes of the object untouched.Tested
Linux, throwaway archive build of this head:
BUILD-EXIT 0, ctestguest_json_allocator_settings(targetguest_json_allocator_settings_tests) passed, 1 of 1.python3 tools/check_conventions.py --base upstream/mainandgit diff --checkare clean. The new case was not run against the unfixed code; that it fails without the fix is reasoned from the code (a null read). Not run on Windows or macOS.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)Imported from boykopovar/AnyPS5. Originally posted by gabichuuuuu on 2026-11-08T23:28:23Z.
Review: COMMENTED
Windows run of head
d4dcfae8fd, merged ontomain286b14d2f7in one tree with 41 other small open PRs that touch different files. Setup: Windows 11, WinLibs GCC 15.2 r7 (x86_64-ucrt-posix-seh, the CI toolchain), Release,BUILD_TESTING=ON.guest_json_allocator_settingswith--repeat until-fail:5: 5 / 5 pass.main'sExport.cppand this PR's test: 5 / 5 runs fail.With a null
allocParam, the constructor leaves*selfzeroed and installs nothing.