summaryrefslogtreecommitdiff
path: root/lib/zlib.js
diff options
context:
space:
mode:
authorFedor Indutny <fedor@indutny.com>2014-06-11 21:11:28 -0700
committerFedor Indutny <fedor@indutny.com>2014-06-27 17:02:02 +0400
commita97bdef06d1451c39df3a4a46f85f285c552a9df (patch)
treef1da99366f68ac7b215362933e3b4bc069308110 /lib/zlib.js
parentc94afdccf32443c9dd5a351fdfe1f19906327138 (diff)
downloadandroid-node-v8-a97bdef06d1451c39df3a4a46f85f285c552a9df.tar.gz
android-node-v8-a97bdef06d1451c39df3a4a46f85f285c552a9df.tar.bz2
android-node-v8-a97bdef06d1451c39df3a4a46f85f285c552a9df.zip
zlib: do not crash on write after close
fix #7767 Signed-off-by: Fedor Indutny <fedor@indutny.com>
Diffstat (limited to 'lib/zlib.js')
-rw-r--r--lib/zlib.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/zlib.js b/lib/zlib.js
index a1896baeb8..c72ab92dcd 100644
--- a/lib/zlib.js
+++ b/lib/zlib.js
@@ -320,6 +320,7 @@ function Zlib(opts, mode) {
util.inherits(Zlib, Transform);
Zlib.prototype.reset = function reset() {
+ assert(!this._closed, 'zlib binding closed');
return this._binding.reset();
};
@@ -394,6 +395,8 @@ Zlib.prototype._transform = function(chunk, encoding, cb) {
var availOutBefore = this._chunkSize - this._offset;
var inOff = 0;
+ if (this._closed)
+ return cb(new Error('zlib binding closed'));
var req = this._binding.write(flushFlag,
chunk, // in
inOff, // in_off
@@ -435,6 +438,7 @@ Zlib.prototype._transform = function(chunk, encoding, cb) {
inOff += (availInBefore - availInAfter);
availInBefore = availInAfter;
+ assert(!self._closed, 'zlib binding closed');
var newReq = self._binding.write(flushFlag,
chunk,
inOff,