addaleax · GitHub

@addaleax changed the title Fix gzip member header/input buffer boundary issue zlib: Fix gzip member header/input buffer boundary issue

Mar 24, 2016

@jasnell jasnell added the zlib

Issues and PRs related to the zlib subsystem.

label

Mar 24, 2016

@addaleax

Closed

3 tasks

Make sure that, even if an `inflate()` call only sees the first
few bytes of a following gzip member, all members are decompressed
and part of the full output.
This change also modifies behaviour for trailing garbage:
If there is trailing garbage which happens to start with the
gzip magic bytes, it is no longer discarded but rather throws
an error, since we cannot reliably tell random garbage from
a valid gzip member anyway and have to try and decompress it.
(Null byte padding is not affected, since it has been pointed
out at various occasions that such padding is normal and
discarded by `gzip(1)`, too.)
Adds tests for the special case that the first `inflate()` call
receives only the first few bytes of a second gzip member but
not the whole header (or even just the magic bytes).

@addaleax

bnoordhuis pushed a commit that referenced this pull request

Mar 31, 2016
Make sure that, even if an `inflate()` call only sees the first
few bytes of a following gzip member, all members are decompressed
and part of the full output.
This change also modifies behaviour for trailing garbage:
If there is trailing garbage which happens to start with the
gzip magic bytes, it is no longer discarded but rather throws
an error, since we cannot reliably tell random garbage from
a valid gzip member anyway and have to try and decompress it.
(Null byte padding is not affected, since it has been pointed
out at various occasions that such padding is normal and
discarded by `gzip(1)`, too.)
Adds tests for the special case that the first `inflate()` call
receives only the first few bytes of a second gzip member but
not the whole header (or even just the magic bytes).
PR-URL: #5883
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>

@bnoordhuis bnoordhuis added the semver-minor

PRs that contain new features and should be released in the next minor version.

label

Mar 31, 2016

@addaleax

addaleax deleted the fix-gzip-member-buffer-boundary branch

March 31, 2016 11:33

@bnoordhuis bnoordhuis added semver-major

PRs that contain breaking changes and should be released in the next major version.

and removed semver-minor

PRs that contain new features and should be released in the next minor version.

labels

Mar 31, 2016

Closed

3 tasks

addaleax added a commit to addaleax/node that referenced this pull request

Apr 2, 2016
Make sure that, even if an `inflate()` call only sees the first
few bytes of a following gzip member, all members are decompressed
and part of the full output.
Adds tests for the special case that the first `inflate()` call
receives only the first few bytes of a second gzip member but
not the whole header (or even just the magic bytes).
This is a backport of nodejs#5883 and contains additional changes to
make sure that the behaviour on encountering trailing garbage
remains the same (namely to silently discard it if one full member
has already been decompressed).
 #PR-URL: nodejs#5883
 #Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
 #Reviewed-By: James M Snell <jasnell@gmail.com>

jasnell pushed a commit that referenced this pull request

Apr 15, 2016
Make sure that, even if an `inflate()` call only sees the first
few bytes of a following gzip member, all members are decompressed
and part of the full output.
Adds tests for the special case that the first `inflate()` call
receives only the first few bytes of a second gzip member but
not the whole header (or even just the magic bytes).
This is a backport of #5883 and contains additional changes to
make sure that the behaviour on encountering trailing garbage
remains the same (namely to silently discard it if one full member
has already been decompressed).
PR-URL: #5973
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>

Closed

Read the original on github.com ↗