fix(libSceHttp): reject repeated transfer-coding fields #18346
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/18346"
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 Ondra97 on 2026-11-11T10:54:17Z.
What
Depends on #18332, included in this branch together with its #18292 prerequisite; merge them first. Both changes touch the duplicate-header guard. The prerequisite's numerical Content-Length recovery is retained, with a separate refusal for a repeated Transfer-Encoding field.
The client currently drops a second
Transfer-Encoding: chunkedwhen its text matches the first field. The equivalent comma-joined coding chain is already refused. This silently changes the declared coding chain and also accepts a later contradictory response. RFC 9110 field-line combination preserves the ordered values; RFC 9112 section 6.1 prohibits a sender from applying chunked twice. Refuse repeated transfer-coding fields under the helper's existing single-chunked policy.The real HTTP fixture covers complete, ranged and empty bodies; a single field with case/OWS variants remains valid. Refusals cover repeated fields, mixed field-name casing, surrounding whitespace, three fields, joined/mixed coding chains and empty members. A late repeated field must leave the destination byte, source size, position and previously cached bytes intact.
Tested
Windows 11 Pro 26300, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release,
BUILD_TESTING=ON,ANYPS5_RELINKER_ONLY=OFF,ANYPS5_ENABLE_SPIRV_TOOLS=ON. CPU: AMD Ryzen 9 7900X. RAM: 31.66 GiB usable. GPU: NVIDIA GeForce RTX 4070 Ti SUPER; these tests do not exercise it.Upstream base:
71ce4789567dfd2c7c4e64779365ea35f8d14174. Standalone fix:488e8f64d2238e7d3e1631a28308710b1f77244a. Tested final head:8202f9c05d5ffa9061451f6c7207cb0a24e7aed8, including #18332 at67b3f6b3ce63a4494cb3150a103ff5e40485e590and #18292 ate8b8026a8d2846b8535ff207b7b13033da43e958.Before editing production code, the exact main passed 9/9 valid controls but refused only 15/27 invalid cases and accepted the late duplicate. With the standalone fix, it passes 9/9, refuses 27/27 and passes the late state-preservation check. Refusal controls accept either an Open failure or the helper's existing unsupported-coding exception; they verify that no source remains open.
The final exact head built the full production libraries, relinker and selected executables. All 11 selected CTests passed, zero failed or skipped, each below 30 seconds. Both direct and actually loaded patched-module client runs report 9/9 transfer controls, 27/27 invalid fields refused and 1/1 late refusal; the inherited Content-Length matrix also remains 45/45 accepted, 72/72 refused and 1/1 late refusal. AvPlayer transport, HTTP exports/options/header parsing/diagnostics, debt-length and the public-header/library-load checks passed. All 407 patched libraries loaded; the audit checked 407 libraries and 33,962 exports.
Combined the exact head locally with #18248, #18270, #18309 and #18317, including their declared prerequisites. Tree
1e382c005790793f3a71361d790d22ebd620e000passed all four selected direct-client, HTTP 203 representation, patched-module and fixed-clock date CTests. The transfer/length matrices run in the direct and patched-module client tests; the 203 test runs its representation matrix. After restoring the exact standalone head, full production targets were rebuilt and all 11 standalone CTests passed again. Each test completed below 30 seconds. The staged Windows provider hash matches the rebuilt provider.Commands from the source checkout, with the supported toolchain on
PATHand the full build in../b:Conventions and whitespace checks passed. The final overlap check fetched 1,977 open heads and examined 1,975 candidates after excluding the two included prerequisites. It compared all four shared-file branches successfully and exited 0 with no overlap. The prerequisite remains explicit in Depends on; the transfer fixture is grouped with the length fixture so it merges cleanly with the separate status/date fixtures.
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-11T15:55:43Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
8202f9c05d:tools/check_conventions.pypassed;git diff --checkclean.guest_http_client_testsbuilt cleanly.guest_http_client):core/libs/prx/libSceHttp/src/Client.cppreverted tomainand the new tests kept, the suite fails: Restoring the change makes it pass again.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-12T15:39:07Z.
Review: COMMENTED
Reviewed libSceHttp repeated transfer-coding refusal — no blocking findings
Nothing blocks this; no optional points remain.
What I ran
8202f9c05d5ffa9061451f6c7207cb0a24e7aed8. Base:main. The description says the branch includes #18332 and #18292; the diff againstmainalready contains both.diff.patch,description.md,commits.md,manifest.json,files.json, and the head text ofClient.cppunderfiles/, read by targeted search and by ranges aroundOpen,ContentLength,NumberandField.check_conventions.py,pr_precheck.py,git diff --check, and the review-body validator (not checked whether it is present).Results
Client.cppNumberrejects empty and out-of-range inputGuestHttpClient.cppCommands and inspections
Inspections were made with the file search and the file reader on
files/and the diff. No shell command was run in this pass.Findings
Blocking
None.
Non-blocking
None.
Sources
Client.cpprepeated Transfer-Encoding refusal:github.com/boykopovar/AnyPS5@8202f9c05d/core/libs/prx/libSceHttp/src/Client.cpp (L412-L417)Client.cppContent-Length list parsing:github.com/boykopovar/AnyPS5@8202f9c05d/core/libs/prx/libSceHttp/src/Client.cpp (L60-L71)Client.cppContent-Length body path:github.com/boykopovar/AnyPS5@8202f9c05d/core/libs/prx/libSceHttp/src/Client.cpp (L461)Client.cppOpenreturns 0 onHttpFailure:github.com/boykopovar/AnyPS5@8202f9c05d/core/libs/prx/libSceHttp/src/Client.cpp (L546-L555)Not verified
AvPlayerHttpServer.py: read through the diff and the import list only. Therespondrouting and the rest of the handler were not read.GuestHttpClient.cpp: read through the diff only. The helpersCreate,Read,EndandCheckwere not read.SeekandRead, which I did not trace beyond the code above.To get this to a good state
Nothing is required.