Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a6b3cd8

Browse filesBrowse files
addaleaxgibfahn
authored andcommitted
doc: more accurate zlib windowBits information
Fixes: #14847 PR-URL: #16511 Backport-PR-URL: #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>
1 parent e5c2059 commit a6b3cd8
Copy full SHA for a6b3cd8

File tree

Expand file treeCollapse file tree

2 files changed

+7
-7
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+7
-7
lines changed
Open diff view settings
Collapse file

‎doc/api/zlib.md‎

Copy file name to clipboardExpand all lines: doc/api/zlib.md
+5-6Lines changed: 5 additions & 6 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -459,12 +459,11 @@ added: v0.5.8
459459
Creates and returns a new [DeflateRaw][] object with the given [options][].
460460

461461
*Note*: An upgrade of zlib from 1.2.8 to 1.2.11 changed behavior when windowBits
462-
is set to 8 for raw deflate streams. zlib does not have a working implementation
463-
of an 8-bit Window for raw deflate streams and would automatically set windowBit
464-
to 9 if initially set to 8. Newer versions of zlib will throw an exception.
465-
This creates a potential DOS vector, and as such the behavior has been reverted
466-
in Node.js 8, 6, and 4. Node.js version 9 and higher will throw when windowBits
467-
is set to 8.
462+
is set to 8 for raw deflate streams. zlib would automatically set windowBits
463+
to 9 if was initially set to 8. Newer versions of zlib will throw an exception,
464+
so Node.js restored the original behavior of upgrading a value of 8 to 9,
465+
since passing `windowBits = 9` to zlib actually results in a compressed stream
466+
that effectively uses an 8-bit window only.
468467

469468
## zlib.createGunzip([options])
470469
<!-- YAML
Collapse file

‎test/parallel/test-zlib.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-zlib.js
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ assert.doesNotThrow(() => {
166166
// value of the matching deflate’s windowBits. However, inflate raw with
167167
// windowBits = 8 should be able to handle compressed data from a source
168168
// that does not know about the silent 8-to-9 upgrade of windowBits
169-
// that older versions of zlib/Node perform.
169+
// that most versions of zlib/Node perform, and which *still* results in
170+
// a valid 8-bit-window zlib stream.
170171
node.pipe(zlib.createDeflateRaw({ windowBits: 9 }))
171172
.pipe(zlib.createInflateRaw({ windowBits: 8 }))
172173
.on('data', (chunk) => reinflated.push(chunk))

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.