Skip to content

Commit bf63a37

Browse files
committed
squash! check windowsBits === 8 early
1 parent c5f18b1 commit bf63a37

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

lib/zlib.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,10 @@ class Zlib extends Transform {
193193
opts.windowBits > constants.Z_MAX_WINDOWBITS) {
194194
throw new RangeError('Invalid windowBits: ' + opts.windowBits);
195195
}
196+
if (mode === constants.DEFLATERAW &&
197+
opts.windowBits === 8) {
198+
throw new RangeError('Unsupported windowBits for DeflateRaw: 8');
199+
}
196200
}
197201

198202
if (opts.level) {

test/parallel/test-zlib-failed-init.js renamed to test/parallel/test-zlib-deflate-unsupported-windowbits.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ const zlib = require('zlib');
1010
// (http://zlib.net/manual.html#Advanced)
1111
assert.throws(() => {
1212
zlib.createDeflateRaw({ windowBits: 8 });
13-
}, /^Error: Init error$/);
13+
}, /^RangeError: Unsupported windowBits for DeflateRaw: 8$/);

0 commit comments

Comments
 (0)