Bug 307952
| Summary: | DecompressionStream should output valid data before throwing for extra trailing bytes | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Brandon <brandonstewart> |
| Component: | WebKit Misc. | Assignee: | Brandon <brandonstewart> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Other | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Brandon
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 | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/170439927>
Brandon
Pull request: https://github.com/WebKit/WebKit/pull/58763
Brandon
See spec update here: https://github.com/whatwg/compression/pull/77
EWS
Committed 307650@main (61a06dede8c6): <https://commits.webkit.org/307650@main>
Reviewed commits have been landed. Closing PR #58763 and removing active labels.
Brandon
Re-opening for pull request https://github.com/apple/WebKit/pull/4621
EWS
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.