fix(libSceHttp): safely probe the outputs of the URI builders #20805
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/20805"
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 Tanju42 on 2026-11-15T15:49:16Z.
What
sceHttpUriBuild,sceHttpUriEscapeandsceHttpUriMergewroterequiredSize/requirethrough direct stores and the output buffer through rawstd::memcpy— an unmapped guest output was a raw host write. Route every one of these writes throughGuestCopyOut_nid_no_patch, in the order the library already wrote them; an unwritable output returnsSCE_HTTP_ERROR_INVALID_VALUE(0x804311FE) and leaveserrnoalone, followingsceHttpsGetSslErrorin the same library. The merge's non-opaque path keeps #12056's zero-padded copy of the relative URI, including the forced terminator at the last byte. Console behavior on unwritable outputs is unmeasured; recorded as adocs/dev/debt/changesfragment.Tested
Ubuntu 24.04 cloud VM, 8 cores, CPU-only (lavapipe), no GPU. Fresh full build tree (configure + 5500+ targets) of this stack: full
ctestgreen and-R guest_httpgreen. No game titles run.core/libs/tests/GuestHttp.cppgainsRequirelines forsceHttpUriBuild,sceHttpUriEscapeandsceHttpUriMerge: unmapped output orrequirepointers returnSCE_HTTP_ERROR_INVALID_VALUEwitherrnopreserved, and a valid call right after a failed one still succeeds.python3 tools/check_conventions.py --base origin/mainclean.pr_overlap.py --branchoutput verbatim below.Independent Windows verification by a contributor: head
0306eb9a23merged alone intomain56c87adbdcon Windows 11 26300 (i7-12700K, WinLibs GCC 15.2.0, Release) — the tests this PR adds/extends,guest_httpandguest_http_uri_locale, pass 2/2 over three runs, and the PR adds no build failure beyondmain's ownUploadCacheReadOnlyFlush.cppsetenvbreak (fixed by #19899) and the Defender AGC-test quarantine case documented inBUILD.md. Not run on a PS5. Full report.Checklist
main; no other open PR implements the same functions — sits on #12056's head3b10a94b24(main228cd64b53); no open PR touches the sixsceHttpUri*exportsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file — no new stubs.mdfiles or images added to the repository (attach them to this PR) — only the mandated debt fragment underdocs/dev/debt/changes/Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/libs/tests/GuestHttp.cppdocs/dev/debt/libSceHttp.mdcore/libs/tests/GuestHttp.cppdocs/dev/debt/libSceHttp.mddocs/dev/debt/libSceHttp.mddocs/dev/debt/libSceHttp.mddocs/dev/debt/libSceHttp.mdManual comparison of that list: #9834 and #11134 edit
core/libs/tests/GuestHttp.cpponly in their transport/CA areas — neither diff line touches the URI or escape tests (git diff origin/main...pr9834 -- core/libs/tests/GuestHttp.cppcontains no URI/escape lines); #14212 is itself a debt-file formatting PR; #18515 and #19769 share onlydocs/dev/debt/libSceHttp.mdentry lines — #19769's GuestCopy pass covers scalar and struct outputs and does not overlap anysceHttpUri*export.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T07:53:05Z.
Review: COMMENTED
Reviewed — no blocking findings
The change routes the URI builder outputs through guest-safe copies and preserves the documented short-buffer behavior; no blocking defect was verified.
What I ran
Reviewed head
0306eb9a23407d4a80e21dbbe04cc34fb693323f. I read the prepared description, commits, manifest, diff, and all four changed files. I inspected the touched helpers and theGuestCopyOut_nid_no_patchimplementation withrepo_read.py. No commands or tests were run.Results
Findings
Blocking
None.
Non-blocking
None.
Sources
The review covered Uri.cpp at the reviewed head, GuestHttp.cpp at the reviewed head, and General.cpp at the reviewed head.
Not verified
Builds, tests, and runtime behavior were not independently verified. The review bundle included full text for every changed file; no changed files were excluded.
To get this to a good state
Nothing is required. Tests and build were not run in this review.
Imported from boykopovar/AnyPS5. Originally posted by malekaifa on 2026-11-23T03:12:06Z.
Review: CHANGES_REQUESTED
@Tanju42 current head
0306eb9a23407d4a80e21dbbe04cc34fb693323fis still stacked on #12056 and preserves its unresolved short-buffer%XXbehavior inProbeTextRaw(value, out, prepare). Firmware 13.42 evidence and @oneandonlydean's Nov. 1 request show that a shortsceHttpUriEscapebuffer must stop before a%XXunit that would cross the end (a b, prepare 2 =>a, nota%). Please let #12056 fix that measured boundary, then restack this PR and retain the guest-pointer safety changes/tests on the corrected behavior. My earlier debt-link conventions objection remains retracted; this is the remaining blocker. AI-assisted: yesImported from boykopovar/AnyPS5. Originally posted by malekaifa on 2026-11-23T15:37:17Z.
Review: APPROVED
Superseding my earlier change request: the conventions-link concern was retracted after reproducing the repository checker, and I have now validated this exact head against current
main.Reviewed exact PR head
0306eb9a23407d4a80e21dbbe04cc34fb693323f. I merged it in an isolated worktree onto current mainc3aec4c2f341247e2ed47ae9365e2eff8e880c75. The merge is conflict-free even though main has since added broader guest-input probing inUri.cppandGuestHttp.cpp; the merged source retains both that newer input safety and this PR'sProbeText/ProbeSizeoutput safety.Machine
main, Windows 11, MSYS2 UCRT64 GCC 16.2.0, Release: current-main + this PR builtguest_http_tests, andctest -R ^guest_http$ --output-on-failurepassed 1/1. The merged tree also passes current conventions andgit diff --check.No blocking findings remain from my review.
AI-assisted review: yes
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T15:23:29Z.
Review: COMMENTED
I ran
guest_httpandguest_http_uri_guest_pointerswith the patch applied on Linux. Both passed, covering the URI builders' valid results and guarded output destinations.AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.