From 661c740c9f91b93b640a3295ae62fd9eee942a89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Fri, 5 Jun 2015 15:22:17 +0200 Subject: [PATCH] add regression test --- test/parallel/test-regress-GH-io-1811.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 test/parallel/test-regress-GH-io-1811.js diff --git a/test/parallel/test-regress-GH-io-1811.js b/test/parallel/test-regress-GH-io-1811.js new file mode 100644 index 00000000000000..17a6d1dab60fb8 --- /dev/null +++ b/test/parallel/test-regress-GH-io-1811.js @@ -0,0 +1,21 @@ +'use strict'; + +const assert = require('assert'); + +// Change kMaxLength to trigger the error without having +// to allocate 1GB of buffers +process.binding('smalloc').kMaxLength = 128; + +const zlib = require('zlib'); + +const encoded = new Buffer('H4sIAAAAAAAAA0tMHFgAAIw2K/GAAAAA', 'base64'); + +// Async +zlib.gunzip(encoded, function(err) { + assert.ok(err instanceof RangeError); +}); + +// Sync +assert.throws(function() { + zlib.gunzipSync(encoded); +}, RangeError);