Skip to content

Commit 661c740

Browse files
committed
add regression test
1 parent ce770de commit 661c740

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
'use strict';
2+
3+
const assert = require('assert');
4+
5+
// Change kMaxLength to trigger the error without having
6+
// to allocate 1GB of buffers
7+
process.binding('smalloc').kMaxLength = 128;
8+
9+
const zlib = require('zlib');
10+
11+
const encoded = new Buffer('H4sIAAAAAAAAA0tMHFgAAIw2K/GAAAAA', 'base64');
12+
13+
// Async
14+
zlib.gunzip(encoded, function(err) {
15+
assert.ok(err instanceof RangeError);
16+
});
17+
18+
// Sync
19+
assert.throws(function() {
20+
zlib.gunzipSync(encoded);
21+
}, RangeError);

0 commit comments

Comments
 (0)