sdk
sdk copied to clipboard
[CP] Fix zlib inflation to ignore data past the ADLER32 trailer.
Commit(s) to merge
https://dart-review.googlesource.com/c/sdk/+/380861
Target
stable
Prepared changelist for beta/stable
https://dart-review.googlesource.com/c/sdk/+/381389
Issue Description
Fixes a regression where ZLibDecoder would attempt to read data past the compressed data's trailer. This happens on all platforms. See https://github.com/dart-lang/sdk/issues/56481
What is the fix
The fix is to modify the ZLibDecoder to have two modes:
- one that stops decompression after the first compression block (this is the default and the behavior prior to Dart 3.5)
- one that decompresses concatenated decompression blocks (required for gzip decompression)
and to modify the gzip decompressor to use (2)
Why cherry-pick
The full impact of the ZLibDecoder regression is unknown. It broke at least one Flutter project: https://github.com/GitJournal/GitJournal/issues/962
Risk
Low. The cherry pick reverts the default behavior of ZLibDecoder to what it was before Dart 3.5, while preserving the ability to decompress gzip files that was added in Dart 3.5.
Issue link(s)
https://github.com/dart-lang/sdk/issues/56481
Extra Info
No response
Summary: The ZLibDecoder in Dart 3.5 incorrectly attempted to read data past the compressed data's trailer, causing a regression. This fix modifies the ZLibDecoder to have two modes, one that stops decompression after the first block and one that decompresses concatenated blocks, and uses the latter for gzip decompression.
lgtm