RESOLVED FIXED307952
DecompressionStream should output valid data before throwing for extra trailing bytes
https://bugs.webkit.org/show_bug.cgi?id=307952
Summary DecompressionStream should output valid data before throwing for extra traili...
Brandon
Reported 2026-02-15 15:15:37 PST
Per the Compression Streams spec, when decompressing data with extra trailing bytes after the end of the compressed stream, the decompressor must: 1. Enqueue the valid decompressed output first 2. Then throw a TypeError Previously, WebKit threw immediately upon detecting extra bytes, discarding the valid output. This change defers the error by: - Adding a throwIfExtraBytes() method to DecompressionStreamDecoder that throws if extra bytes were detected during the previous decode() call - Modifying the JS transform algorithm to call throwIfExtraBytes() after enqueuing the decoded output - Separating "extra bytes" detection (Z_STREAM_END with remaining input) from "incomplete input" detection (Z_BUF_ERROR during flush) in the zlib path, since incomplete input should still throw immediately
Attachments
Radar WebKit Bug Importer
Comment 1 2026-02-15 15:15:43 PST
Brandon
Comment 2 2026-02-15 15:17:06 PST
Brandon
Comment 3 2026-02-15 15:21:49 PST
EWS
Comment 4 2026-02-16 09:47:30 PST
Committed 307650@main (61a06dede8c6): <https://commits.webkit.org/307650@main> Reviewed commits have been landed. Closing PR #58763 and removing active labels.
Brandon
Comment 5 2026-03-05 13:10:00 PST
Re-opening for pull request https://github.com/apple/WebKit/pull/4621
EWS
Comment 6 2026-03-09 13:13:37 PDT
Committed 305413.416@safari-7624-branch (8b3a915b1f5f): <https://commits.webkit.org/305413.416@safari-7624-branch> Reviewed commits have been landed. Closing PR #4621 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.