diff options
author | Anna Henningsen <anna@addaleax.net> | 2017-10-26 12:32:23 +0200 |
---|---|---|
committer | Gibson Fahnestock <gibfahn@gmail.com> | 2017-10-31 00:15:12 +0000 |
commit | a6b3cd8166d6d8362f3e0b4fc0d1dc180c8aa13c (patch) | |
tree | cab314f517bb73d8a32a45c2c0de4ccab261e5c5 | |
parent | e5c2059f887f1e5d467f2859da286616b166b30a (diff) | |
download | node-new-a6b3cd8166d6d8362f3e0b4fc0d1dc180c8aa13c.tar.gz |
doc: more accurate zlib windowBits information
Fixes: https://github.com/nodejs/node/issues/14847
PR-URL: https://github.com/nodejs/node/pull/16511
Backport-PR-URL: https://github.com/nodejs/node/pull/16623
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
-rw-r--r-- | doc/api/zlib.md | 11 | ||||
-rw-r--r-- | test/parallel/test-zlib.js | 3 |
2 files changed, 7 insertions, 7 deletions
diff --git a/doc/api/zlib.md b/doc/api/zlib.md index 9b7b30aa7d..180ae431c2 100644 --- a/doc/api/zlib.md +++ b/doc/api/zlib.md @@ -459,12 +459,11 @@ added: v0.5.8 Creates and returns a new [DeflateRaw][] object with the given [options][]. *Note*: An upgrade of zlib from 1.2.8 to 1.2.11 changed behavior when windowBits -is set to 8 for raw deflate streams. zlib does not have a working implementation -of an 8-bit Window for raw deflate streams and would automatically set windowBit -to 9 if initially set to 8. Newer versions of zlib will throw an exception. -This creates a potential DOS vector, and as such the behavior has been reverted -in Node.js 8, 6, and 4. Node.js version 9 and higher will throw when windowBits -is set to 8. +is set to 8 for raw deflate streams. zlib would automatically set windowBits +to 9 if was initially set to 8. Newer versions of zlib will throw an exception, +so Node.js restored the original behavior of upgrading a value of 8 to 9, +since passing `windowBits = 9` to zlib actually results in a compressed stream +that effectively uses an 8-bit window only. ## zlib.createGunzip([options]) <!-- YAML diff --git a/test/parallel/test-zlib.js b/test/parallel/test-zlib.js index b1a64b35fc..b2201fca4c 100644 --- a/test/parallel/test-zlib.js +++ b/test/parallel/test-zlib.js @@ -166,7 +166,8 @@ assert.doesNotThrow(() => { // value of the matching deflateās windowBits. However, inflate raw with // windowBits = 8 should be able to handle compressed data from a source // that does not know about the silent 8-to-9 upgrade of windowBits - // that older versions of zlib/Node perform. + // that most versions of zlib/Node perform, and which *still* results in + // a valid 8-bit-window zlib stream. node.pipe(zlib.createDeflateRaw({ windowBits: 9 })) .pipe(zlib.createInflateRaw({ windowBits: 8 })) .on('data', (chunk) => reinflated.push(chunk)) |