fix(http2): validate and decode concatenated gzip members #15231
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15231"
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 JJenkx on 2026-11-02T21:25:35Z.
What
Valid concatenated gzip members currently throw, and optional FHCRC bytes are skipped without checking them. Iterate the existing gzip framing parser, reset raw inflate between members, verify each member's CRC32/ISIZE, and check FHCRC over that member's header. Empty members and combined decoded lengths work; the existing 64 MiB combined decoded limit stays in force.
Current head
939d961c50fa6b28d514b2d1ea19441841a6b8ebincludes pinned mainb11c7bf84f5d2f636ff60166cc3371bd071e24d5and preserves the reviewed gzip decoder from3989a014e7. No pending HTTP prerequisites. The vendored zconf.h disables built-in gzip wrapping, so this retains the bounded explicit parser and existing raw zlib backend. No new dependency or third-party changes.Format semantics: RFC1952 member structure and integrity. Console buffering, length/header reporting, size limits and error mappings remain unverified in debt; this is protocol correctness, not a console-parity claim.
The original overlap audit checked1,716 open heads. Shared fixtures/debt touch #11611, #11630, #11922, #11950, #12305, #12456 and our #15221; no other implementation of this member/FHCRC behavior was found. #11470/#13486/#14212 have incomplete comparisons because they conflict with the base. Our #15221 includes this actual refreshed head at
e064f99e62ce1e4ab25ddc3adcccd254c4133e95and remains ordered after it. Its fresh Linux qualification is recorded there. This pure-main branch does not require the HTTP/1 prerequisite stack.Tested
Latest qualification (2026-11-04): exact head
939d961c50fa6b28d514b2d1ea19441841a6b8eb, tested mainb11c7bf84f5d2f636ff60166cc3371bd071e24d5. Production outsideInflateGzipis byte-identical to main; the decoder is byte-identical to old reviewed head3989a014e7. The shared fixture preserves main's HTTP/1, TLS-handshake, SSL-callback, redirect and early-response coverage, with enum order retained.Linux x86_64, GCC 16.2.1, Release, CPU-only loopback: 13/13 passed, zero skips (12 HTTP2 groups plus public headers). The actual raw production module and fixtures rebuilt; production NID patching, conventions, whitespace, and MinGW syntax for Export.cpp/Transport.cpp passed. With only main's Transport.cpp substituted, both member/header groups fail at the expected concatenated-member/header-checksum checks. Restoring this head passes both groups and reproduces the exact source, fixture-executable and shared-library hashes.
Commands, preservation proofs, logs, JUnit and hashes. No new Windows/macOS runtime, console, title, GPU or performance claim. Earlier qualifications below retain their original pins.
Linux7.2.11 Arch, Ryzen 9 7950X, GCC16.2.1, Release; CPU-only loopback.
guest_http2*groups pluspublic_headers:11/11, zero skips.9090972b7e91and merged this exact head. All11 registeredguest_http2*groups passed, including_gzip_members(0.35s) and_gzip_headers(0.13s). Windows CI log. The overall job is failed:guest_avplayer_http,avplayer_http_transport,avplayer_http_patched_modulesandguest_http_clienttimed out. Windows worker follow-up on unchanged main5cb015caaaaand main plus this exact head: the same four tests pass serially3/3 on each side (24 executions, zero failures/skips; JUnit independently checked). Control evidence, SHA25688eb6e24fd4e7886754df181fdc97a2b2818d921adfd9d3a51d881100ead9f98. These controls did not reproduce the timeouts; the original CI failure remains unresolved, with no timeout or production change claimed.Source, full logs, JUnit, compile commands, loader bindings, hashes and control procedure, SHA256
93219cc26580343f1ae8cd51ddc05f0512ab82849b200baaf7a797e0a4388f92.Independent current-head AMD follow-up: TechLevelZero report, exact
2845d2c1c078merged onto7feb37ee3e30, RX6300/RADV Mesa25.2.8. The selected 1,134 tests produced1,122 passes,5 failures (3 also fail on main and2 unstable on main),7 skips, and no new validation IDs across539 GPU tests. This is attributed third-party evidence, not an all-green full-suite result. The separate upstream Windows timeout job remains unresolved; local main/PR controls and the maintainer rerun request above do not change that CI status.Independent Windows review by BunnyFl covers exact head
3989a014e7merged onto main (mergea9c7022d50): Windows 11, WinLibs GCC, Release. All twelve HTTP2 groups pass; restoring only main’s Transport.cpp while retaining this head’s tests fails exactly gzip member/header validation, while the other ten groups pass. These are the reviewer’s reported runs; the report does not specify the compiler version or host CPU. No source change or new author-run Windows test accompanies this attribution.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 BunnyFl on 2026-11-03T23:31:05Z.
Review: APPROVED
@JJenkx approved at
3989a014e7.What I ran: this head merged onto
main(mergea9c7022d50), Windows 11, WinLibs GCC, Release.guest_http2*tests pass (12 of 12), includingguest_http2_gzip_membersandguest_http2_gzip_headers.main'score/libs/prx/libSceHttp2/Transport.cppput back and this branch's tests kept, exactly those two fail (2 of 12 failed). The other ten still pass.Read in
InflateGzip, per member:size - offset >= 18), not only the first.inflateis given everything from the member's data to the end of the body. AfterZ_STREAM_END,offset = size - inflater.avail_inlands on the member's trailer. CRC32 and ISIZE are checked over that member's slice ofoutput, and an empty member'scrc32(0, nullptr, 0)is 0, as it should be.inflateResetruns only when another member follows.skipnow checksoffset <= size - 8 && count <= size - 8 - offset(Transport.cpp:406); neither subtraction can wrap.insert(count <= MaxGzipBytes - output.size()).uIntcasts ofavail_inand the CRC lengths in range.One behaviour worth knowing, and already in your tests: any bytes after the last member that aren't another gzip member now fail as
malformed gzip header.gzip -dwarns about trailing garbage and keeps the decoded data instead. Neither is a console measurement, and the debt entry already leaves console error mapping unverified, so throwing is fine.Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-04T15:46:20Z.
Review: APPROVED
@JJenkx re-checked at
939d961c50.git range-diffof my approved3989a014e7against this head shows that commit unchanged; the rest is the merge ofmainb11c7bf84f.What I ran: head
939d961c50(it already containsmainb11c7bf84f), Windows 11, WinLibs GCC, Release,BUILD_TESTING=ON:guest_http2*andpublic_headers: 14 of 14 pass. That coversmain's HTTP/1, TLS-handshake, SSL-callback, redirect and early-response groups next to yours.main'score/libs/prx/libSceHttp2/Transport.cppand the tests kept,guest_http2_gzip_membersandguest_http2_gzip_headersabort. The other 12 pass.core/libs/tests/GuestHttp2Transport.cpp. Merging the two ontomainin either order conflicts in that test file only;Transport.cppmerges cleanly. If this lands first, I'll resolve it on #11950's side.