fix(libSceHttp): fill a short sceHttpUriEscape buffer as a PS5 does #12056
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12056"
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 Aspct3434 on 2026-10-27T17:48:58Z.
When prepare was too small for the escaped text and its terminator, sceHttpUriEscape stored the full size in require and left the output untouched before returning SCE_HTTP_ERROR_OUT_OF_MEMORY.
A PS5 does the reverse. In the console oracle row
nh_escape_buffer_too_small (an 8-byte output, prepare 4, "hello world") it returned 0x80431022, wrote "hell" without a terminator and did not touch require:
github.com/mattias800/prosper@9a9a4bd1b8/prosper/tests/data/console_oracle/nethttp.golden.tsv (L37)The other escape rows of that file (lines 31 to 36) already matched.A buffer that is too short now gets the first prepare bytes of the escaped text, and require is written only on success, the way sceHttpUriUnescape already treats a short buffer. What the console writes of a %XX sequence that reaches the end of the buffer was not measured; the debt entry says so and lists the input bytes the oracle covers, in place of the claim that no non-ASCII input was measured.
guest_http checks the measured row and that a buffer one byte short leaves require alone.
Claude-Session: https://claude.ai/code/session_01DXPnhogDW4zpeNCBro4Ctt
What
A sceHttpUriEscape buffer too short for the escaped text now gets the first
preparebytes of it andrequireis left alone, matching the PS5 console oracle rownh_escape_buffer_too_small.Tested
guest_http: 5/5 on Windows 11 (MinGW GCC 15.2) and 10/10 on Linux (WSL2, GCC 11.4) by third-party runs in the comments; with
Uri.cpprestored to main, the PR's test aborts.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)Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T18:14:28Z.
Review: CHANGES_REQUESTED
The implementation and the new oracle-backed assertions look consistent with the measured row, including leaving
requireunchanged on the short-buffer error. I could not rerunguest_http_testslocally in this review environment, so I am relying on the submitted oracle evidence and the passing Windows relinker job for execution evidence.Please complete the required PR template before this is ready to merge. The current description leaves
What,Tested,Depends on,Fixes,Unblocks, andAI-assistedunanswered, and the latest conventions check fails for the incomplete template. The existing collaborator comment already identifies this; please update the description and rerun the check.Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-12-03T10:30:14Z.
Review: COMMENTED
Actionable comments
0a4c2eb9-920a-4e51-98f6-dd7c9549549cReviewing files that changed from the base of the PR and between
228cd64b53and7952a37790.core/libs/prx/libSceHttp/src/Uri.cppcore/libs/tests/GuestHttp.cppdocs/dev/debt/libSceHttp.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-03T11:07:30Z.
Review: APPROVED
Reviewed — looks good
The short-buffer escape path writes only complete escaped units, leaves
requireuntouched, and is covered by the added boundary checks.What I ran
Reviewed head
7952a37790a2228489c13afd4bcf1909e1b0b09cusing the prepared diff and file snapshots. No tests or builds were run. Therepo_read.pyattempt could not complete because it tried to write its read log in the read-only run folder.Results
Findings
Blocking
None.
Non-blocking
None.
Sources
Uri.cppGuestHttp.cpplibSceHttp.mdNot verified
The author-reported Windows and Linux test runs were not independently confirmed. Console behavior for percent-encoded units that meet the end of a short buffer was not measured, as the description states. Read:
core/libs/prx/libSceHttp/src/Uri.cpp,core/libs/tests/GuestHttp.cpp, anddocs/dev/debt/libSceHttp.md. Excluded: none.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T11:31:58Z.
Review: COMMENTED
Built the submitted URI implementation and ran the focused escape cases from
GuestHttpon Linux. They passed, including writing only complete escape units into a short buffer and preserving the length output on failure. The full mixed-library fixture aborted, so this result covers the focused escape cases. I flagged the debt entry change inline.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.