Skip to content
This repository was archived by the owner on Oct 16, 2021. It is now read-only.

Commit 5fc6d92

Browse files
committed
Merge tag 'v4.8.5' into v4.x-port
2017-10-24 v4.8.5 'Argon' (Maintenance) Release Git-EVTag-v0-SHA512: 1e860c6502c3718af9f8f344b0b257f3d1d520acbabfdebba1d0b5ea1b375dddfb5c1afe3c076b6d9e18e816fecf20ecee2b6355965c4707df5fc1f63c8ccf08
2 parents e02efbc + 83d5580 commit 5fc6d92

5 files changed

Lines changed: 45 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Node.js ChangeLog
22

3+
## 2017-10-24, Version 4.8.5 'Argon' (Maintenance), @MylesBorins
4+
5+
This is a security release. All Node.js users should consult the security release summary at https://nodejs.org/en/blog/vulnerability/oct-2017-dos/ for details on patched vulnerabilities.
6+
7+
### Notable Changes
8+
9+
* **zlib**:
10+
- CVE-2017-14919 - In zlib v1.2.9, a change was made that causes an error to be raised when a raw deflate stream is initialized with windowBits set to 8. On some versions this crashes Node and you cannot recover from it, while on some versions it throws an exception. Node.js will now gracefully set windowBits to 9 replicating the legacy behavior to avoid a DOS vector. [nodejs-private/node-private#95](https://github.com/nodejs-private/node-private/pull/95)
11+
12+
### Commits
13+
14+
* [[`f5defa2a7c`](https://github.com/nodejs/node/commit/733578bb2e)] - **zlib**: gracefully set windowBits from 8 to 9 (Myles Borins) [nodejs-private/node-private#95](https://github.com/nodejs-private/node-private/pull/95)
15+
316
## 2017-07-11, Version 4.8.4 'Argon' (Maintenance), @MylesBorins
417

518
This is a security release. All Node.js users should consult the security release summary at https://nodejs.org/en/blog/vulnerability/july-2017-security-releases/ for details on patched vulnerabilities.

doc/api/zlib.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,14 @@ added: v0.5.8
373373

374374
Returns a new [DeflateRaw][] object with an [options][].
375375

376+
*Note*: An upgrade of zlib from 1.2.8 to 1.2.11 changed behavior when windowBits
377+
is set to 8 for raw deflate streams. zlib does not have a working implementation
378+
of an 8-bit Window for raw deflate streams and would automatically set windowBit
379+
to 9 if initially set to 8. Newer versions of zlib will throw an exception.
380+
This creates a potential DOS vector, and as such the behavior ahs been reverted
381+
in Node.js 8, 6, and 4. Node.js version 9 and higher will throw when windowBits
382+
is set to 8.
383+
376384
## zlib.createGunzip([options])
377385
<!-- YAML
378386
added: v0.5.8

lib/zlib.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ function Gunzip(opts) {
266266

267267
// raw - no header
268268
function DeflateRaw(opts) {
269+
if (opts && opts.windowBits === 8) opts.windowBits = 9;
269270
if (!(this instanceof DeflateRaw)) return new DeflateRaw(opts);
270271
Zlib.call(this, opts, binding.DEFLATERAW);
271272
}

src/node_version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#define NODE_MAJOR_VERSION 4
55
#define NODE_MINOR_VERSION 8
6-
#define NODE_PATCH_VERSION 4
6+
#define NODE_PATCH_VERSION 5
77

88
#define NODE_VERSION_IS_LTS 1
99
#define NODE_VERSION_LTS_CODENAME "Argon"

test/parallel/test-zlib.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,28 @@ SlowStream.prototype.end = function(chunk) {
131131
return this.ended;
132132
};
133133

134+
// windowBits: 8 shouldn't throw
135+
assert.doesNotThrow(() => {
136+
zlib.createDeflateRaw({ windowBits: 8 });
137+
}, 'windowsBits set to 8 should follow legacy zlib behavior');
138+
139+
{
140+
const node = fs.createReadStream(process.execPath);
141+
const raw = [];
142+
const reinflated = [];
143+
node.on('data', (chunk) => raw.push(chunk));
144+
145+
// Usually, the inflate windowBits parameter needs to be at least the
146+
// value of the matching deflate’s windowBits. However, inflate raw with
147+
// windowBits = 8 should be able to handle compressed data from a source
148+
// that does not know about the silent 8-to-9 upgrade of windowBits
149+
// that older versions of zlib/Node perform.
150+
node.pipe(zlib.createDeflateRaw({ windowBits: 9 }))
151+
.pipe(zlib.createInflateRaw({ windowBits: 8 }))
152+
.on('data', (chunk) => reinflated.push(chunk))
153+
.on('end', common.mustCall(
154+
() => assert(Buffer.concat(raw).equals(Buffer.concat(reinflated)))));
155+
}
134156

135157
// for each of the files, make sure that compressing and
136158
// decompressing results in the same data, for every combination

0 commit comments

Comments
 (0)