fix(libSceHttp): copy URIs as measured on a PS5 #9073
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9073"
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 orezraey on 2026-10-21T11:46:31Z.
What
sceHttpUriCopywas written from a reading of the libSceHttp.sprx disassembly, and its debt entry said it was not measured on a console. In a payload process on a PS5 (firmware 13.60) every ordinary input already matched:preparebytes cleared;requireon success, and left alone on a short pool;The one difference is the order of operations. The console clears the whole output element and all
preparepool bytes before it reads the source, so a source that is the output itself, or that lies inside the pool, is read after it was cleared:mainbefore this PRout == srcrequire5: all five strings empty, port 0require5: all five strings empty, port 0require0x12, while sizing only counts the real string: 0x1c)preparepast a guard page)This PR clears
outand the pool first, then reads the source pointers and the port, computes the size and copies. A short pool returnsERROR_OUT_OF_MEMORYwith both already cleared, as before.Not measured: whether the console writes the strings before it checks the size. A short pool always ends up cleared, so the order can't be seen. The debt entry says so.
Tests:
guest_httpchecks, inside the existingsceHttpUriCopyblock:require, the padding and the reserved bytes;out == src, and a source element or a source string inside the pool.The new checks fail on
mainand pass here.Debt: the
sceHttpUriCopyentry indocs/dev/debt/libSceHttp.mdnow describes the measured behaviour and the one unmeasured point.How the console was measured
sceHttpInitwas not needed and not called.libSceHttp.sprxwas loaded withdlopen, andsceHttpUriCopyandsceHttpUriParsewere taken from it withdlsym.sceHttpUriParseand from hand-built elements.~, outputs with 0x5a, andrequireis preset to 0xabcd; every output pointer is logged as an offset into the pool.uricopy2anduricopy3put the pool before a guard page to see the clearing, and alias the source with the output and the pool.Console output (excerpt, copied unchanged)
Tested
Windows 11, WinLibs GCC 15.2.0, Release:
guest_http,guest_http_response_headerandguest_http2pass. Not tested on Linux or with a title.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 xXPBSXx on 2026-10-21T16:14:35Z.
Independent Windows run of this PR (data only).
Environment: Windows 10 Pro 10.0.19045, Ryzen 7 5800X3D, WinLibs GCC 15.2.0 r7 (MinGW-w64 UCRT), Release, BUILD_TESTING=ON. Merge-tree of the PR head against
mainis clean. I built onlyguest_http_tests;ctest -N -R guest_httplists exactly one test.PR head tested:
19d7e29b3a8bcb215783f4480910fa2601237bd4.Results (3 runs each):
guest_httppasses 3/3.core/libs/prx/libSceHttp/src/Uri.cppwith the version from the PR's merge base (3e91c8edf5), then rebuilt. The test fails 3/3 (exit 0xc0000409). I restored the PR's files afterwards.GPU: the run output has no
Selected GPUline; no GPU claim is made.Not run: other platforms, the other tests in the same family, the full repository CTest, and any title or console run.
AI-assisted (Claude Code).