fix(libSceRudp): check the context status arguments first and initialization before the id pointer #13871
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/13871"
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 zaryabzip on 2026-10-31T10:22:41Z.
What
Replaces #13849, which the open-PR limit closed and GitHub won't reopen; same branch and head.
Two libSceRudp answers now follow the firmware readings on #13682.
sceRudpGetContextStatus(int ctxId, void* status, size_t size)statusor asizeoutside 1 to 0x30 returns0x80770004, before the id is looked up.sizeis 64 bits: @BunnyFl's second run refuses 0x100000010, which auint32_twould cut to 0x10 and accept.maindeclared ituint32_t, as the 10.71 reading types it, so PS4 and PS5 may differ here.0x80770003.sizebytes of a 0x30-byte block. The block is zero except for0xFFFFFFFFat bytes 4-7, which is what the 13.42 run read for an idle context.On
mainit accepted any size, returned 0 for a null pointer, checked the id first, and wrote zeros. Every context answers with the idle block here. The second run read the same block for a bound context, and 6 in bytes 0-3 for a listening one, whichmaincan't produce yet (#13799 adds listening); the debt entry records it.sceRudpCreateContext: before initialization, a null id pointer returns0x80770001, as in the 13.42 run.mainchecked the pointer first and returned0x80770004. It gets its own debt entry.No function changes count.
GuestRudpContextLifecycle.cppchanges to match:sizestay untouched.sceRudpCreateContext(handler, NULL, NULL)before init.Overlap: this doesn't depend on my other Rudp PRs (#13718, #13799, #13814). Against
main73f4f7e06e,git merge-treemerges it cleanly with each of them (#13799 at its new head651808a48b), with #11042, with @ntamas94's docs-only #13844, and with every other open pull request that merges withmain. #13844 records the same 10.71 reading in its own debt entry, so one of the two entries can go when the second lands.Tested
Windows 11 (WinLibs MinGW-w64 GCC 15.2.0 UCRT r7, CMake 4.3.1, Ninja 1.13.2) and Ubuntu 24.04 on WSL2 (GCC 13.3.0, CMake 3.28.3, Ninja 1.11.1), both with the head
e70388ccd5merged intomain73f4f7e06e.Export.cpp,include/Api.hpporGuestRudpContextLifecycle.cpp. Every file that includesApi.hpprebuilds with no warnings, and so does each header compiled on its own.ctest -R "guest_rudp|rudp_poll|guest_offline_imports": 7 of 7 pass on WSL2 and 8 of 8 on Windows (plusrudp_poll_wait_exception).guest_rudp_context_lifecyclepasses 3 of 3 on--repeat until-fail:3.553f1a82d2with only the new test file aborts at the 0x100000010 row (line 191) on both hosts (Windows exit 0xc0000409, Linux SIGABRT), and GCC warns there that the size becomes 16.main1b91748340with only the test change,guest_rudp_context_lifecycleaborts atsceRudpCreateContext(Handler, nullptr, nullptr) == notInitialized(line 127) on both hosts.tools/check_conventions.pypasses.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 MarcZX10 on 2026-10-31T10:34:56Z.
Review: APPROVED
Reviewed — looks good
At head
553f1a82d2ccfb49369105d1914559826bf4b84a, the validation order and bounded status copy match the PR’s stated firmware evidence, with no blocker found.What I ran
Reviewed head
553f1a82d2ccfb49369105d1914559826bf4b84aagainst basecf5a1805e50ceeccf6574abd98b13e9783c412c1; merge preview was clean against currentmainatfd31320e83fe417fa9c7fef792613653d9eb4f02. Environment: Linux x86_64, Python 3.11.2, GCC 12.2.0. No local build or C++ test was run.Results
mainConvention-check stdout (verbatim)
Negative control
sceRudpCreateContext(..., nullptr)before initialization returnsRUDP_ERROR_NOT_INITIALIZEDFindings
Blocking
None found.
Non-blocking
The current workflow skipped Linux, so the Linux-specific implementation path is supported here by the author’s reported WSL2 run rather than hosted CI or my own run.
Sources
sceRudpGetContextStatussceRudpCreateContextNot verified
I did not run the C++ tests locally or verify behavior on console hardware. The Linux-specific path was not run by hosted CI.