fix(libSceHttp): validate the id of the send, receive, resolve, block size, header size and content length setters #24528
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/24528"
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 AlfaRojo on 2026-11-20T18:51:05Z.
What
sceHttpSetSendTimeOut,sceHttpSetRecvTimeOut,sceHttpSetResolveTimeOut,sceHttpSetResolveRetry,sceHttpSetRecvBlockSize,sceHttpSetResponseHeaderMaxSizeandsceHttpSetRequestContentLengthreturned 0 for any id, beforesceHttpInittoo, and kept nothing. They now live incore/libs/prx/libSceHttp/src/Options.cpp:184-219next to the other option setters and:ERROR_BEFORE_INITuntilsceHttpInit;ERROR_INVALID_IDfor an unknown or deleted id;HttpOptions(new fields inOptions.hpp), copied from the parent as the existing options are;sceHttpSetRequestContentLengthtakes only a request (newHttpOptions::request, set by the foursceHttpCreateRequest*calls) and refuses a template or connection withERROR_INVALID_ID;sceHttpSetResolveRetryrefuses a negative count andsceHttpSetResolveTimeOutrefuses 999999 us or less when the title was built with SDK 1.70 or later, both withERROR_INVALID_VALUEbefore the id check.Evidence and limits (also in the debt fragment). The firmware 13.42 disassembly in
docs/dev/debt/libSceHttp.mdis recorded only forsceHttpSetHttp09Enabled,sceHttpSetPriorityOptionandsceHttpSetPolicyOption("checks initialisation, then stores each value through one option setter that refuses an unknown id"); I did not disassemble these seven, so I apply the same order to them as an inference. Which kinds each takes and the two value checks come from shadPS4src/core/libraries/network/http.cppat 264d6b71d8 (sceHttpSetSendTimeOut3017,sceHttpSetRecvTimeOut3034,sceHttpSetResolveTimeOut2665,sceHttpSetResolveRetry2978,sceHttpSetRecvBlockSize2186,sceHttpSetResponseHeaderMaxSize2689,sceHttpSetRequestContentLength2913): PS4, not measured on a PS5. No merged PR or issue measures these calls on a console. shadPS4's busy error for a request already sent is not modelled (no request is ever sent), and the content length given tosceHttpCreateRequest*is still ignored. Defaults (0) are unmeasured. shadPS4 code was not copied.The debt fragment
docs/dev/debt/changes/fix-http-setters-validate-id.mdremoves the seven from the Silent stubs entries (rewriting thesceHttpSetResponseHeaderMaxSize/sceHttpSetRecvBlockSizeone, dropping the send/receive/content-length, resolve-retry and resolve-timeout ones), notes thatsceHttpSetConnectTimeOutstill does not check its id, and adds one entry with the above.Tested
Windows 11, WinLibs GCC 15.2, Release,
-DBUILD_TESTING=ON; offline guest tests only, no title or console.core/libs/tests/GuestHttpOptions.cpp: newCheckStoredLimits(line 284) covers, for a template, connection and request, every setter's success and stored value (including 0 and values above 2^31 and 2^32),BEFORE_INITbeforesceHttpInit(CheckOfflineSettersBeforeInit), unknown, context and deleted ids, content length refused on a template and connection and not kept, the negative retry, the sub-second resolve timeout at SDK 1.70 and the same value accepted at SDK 1.6FFFFF, and the value check coming before the id check.core/libs/tests/GuestHttp.cpp: the two calls that expected 0 after the lastsceHttpTermnow expectBEFORE_INIT.main: withsrc/restored toupstream/mainand the tests as in this PR,ninja tests/guest_http_options_tests.exefails ("'const struct HttpOptions' has no member named 'sendTimeoutUs'") andctest -R "^guest_http$"aborts (Exit code 0xc0000409) because the stubs returned 0 aftersceHttpTerm.ctest -R "guest_http_|guest_http$" -E http2in a build of allguest_http_*_tests: 20/20 passed.py -3 tools/check_conventions.py --base upstream/main: all checks passed;py -3 tools/debt_fold.py --check: no output.AddHttpChild(id, conn_id)lines this PR changes; neither changes the seven setters.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 PrivacyOnion on 2026-11-20T20:04:36Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
9fba7a84b1:tools/check_conventions.pypassed.guest_http_options_tests,guest_http_testsbuilt cleanly.guest_http,guest_http_uri_locale,guest_http_options):core/libs/prx/libSceHttp/Export.cpp,core/libs/prx/libSceHttp/src/Options.cpp,core/libs/prx/libSceHttp/src/Options.hppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T20:20:30Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the points below are optional.
What I ran
Reviewed head
9fba7a84b19af3723723122569b2b60df38830edusing the prepared diff and pinnedrepo_read.pyreader. No commands or tests were run during this review.Results
manifest.jsonlists no excluded changed filesFindings
Blocking
None.
Non-blocking
None.
Not verified
No runtime checks were performed. The author reports 20/20 guest HTTP tests and convention checks passing; those results were not independently run. Console behavior and the PS5 firmware behavior inferred from shadPS4 were not verified.
files.jsonwas not available through the reader; exclusion status was checked inmanifest.json.Files read:
description.md,commits.md,manifest.json,diff.patch;Export.cpp,Options.cpp,Options.hpp,GuestHttp.cpp,GuestHttpOptions.cpp, andfix-http-setters-validate-id.md. All six changed files were listed as included inmanifest.jsonand read. No files were listed as excluded.To get this to a good state
Nothing is required. The PS5 behavior inference and lack of console measurements are documented limitations.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T20:06:51Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the points below are optional.
What I ran
Reviewed head
81b4bc374f321fb0f2cc50861e84918de923ddd6from the prepared diff and targeted source reads. No tests or builds were run;repo_read.pywas not invoked directly because this review interface provides pinned-head reader tools.Results
files.jsonwas not available in the bundleFindings
Blocking
None.
Non-blocking
core/libs/prx/libSceHttp/src/Options.cpp:197.core/libs/prx/libSceHttp/src/Options.cpp:207.Not verified
No tests, build, console behavior, or firmware disassembly were verified in this review. The bundle included the full text of all six changed files, and all six were read:
core/libs/prx/libSceHttp/Export.cpp,core/libs/prx/libSceHttp/src/Options.cpp,core/libs/prx/libSceHttp/src/Options.hpp,core/libs/tests/GuestHttp.cpp,core/libs/tests/GuestHttpOptions.cpp, anddocs/dev/debt/changes/fix-http-setters-validate-id.md.files.jsonwas unavailable, so the reviewed-file list could not be compared with a separate reviewed manifest.To get this to a good state
Nothing is required. The optional follow-up is to measure or confirm the inferred PS5 behavior and connect stored options to behavior when HTTP requests are implemented.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T14:44:09Z.
Review: COMMENTED
Built the changed HTTP units and ran the branch's
GuestHttpandGuestHttpOptionsfixtures against the existing Linux runtime. Both passed. I checked that the seven setters accept live handles of the supported kinds and route invalid IDs through the shared validation path.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.