Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

zlib inflate/deflate/gunzip/gzip crashes when called on non-string input #2384

Closed
nlacasse opened this issue Dec 20, 2011 · 1 comment
Closed
Labels

Comments

@nlacasse
Copy link

Node v0.6.6 on Linux

Calling any of the zlib "convenience methods" (inflate, deflate, inflateRaw, deflateRaw, gzip, gunzip, gzipRaw, gunzipRaw) with a non-string input results an uncaught error about removeListener.

For example:

zlib.gunzip(1, function (err, result) {
  console.log(err);
});

Expected:
"Invalid argument" error should be logged.

Actual:

Error: removeListener only takes instances of Function
    at Gzip.removeListener (events.js:165:11)
    at Gzip.<anonymous> (zlib.js:126:12)
    at Gzip.emit (events.js:67:17)
    at Gzip.write (zlib.js:291:17)
    at zlibBuffer (zlib.js:158:10)
    at Object.gzip (zlib.js:98:3)

It appears that zlibBuffer is not passing a function argument to removeListener on lines 165 and 166.

nlacasse pushed a commit to nlacasse/node that referenced this issue Dec 20, 2011
@benverhees
Copy link

@joyent this issue can be closed, the change has already landed in 40c9348

@isaacs isaacs closed this as completed Feb 10, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants