Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gunzipSync DOA in Node 14.15.2 #36615

Closed
ledbit opened this issue Dec 24, 2020 · 2 comments · Fixed by #36618
Closed

gunzipSync DOA in Node 14.15.2 #36615

ledbit opened this issue Dec 24, 2020 · 2 comments · Fixed by #36618
Assignees
Labels
confirmed-bug Issues with confirmed bugs. zlib Issues and PRs related to the zlib subsystem.

Comments

@ledbit
Copy link

ledbit commented Dec 24, 2020

What steps will reproduce the bug?

Any code using gunzipSync will crash

$ cat gunzip.js 
const { gunzipSync } = require('zlib');
console.log(gunzipSync('fooobar'));

$ node -v
v14.15.2

$ node gunzip.js 
internal/streams/readable.js:193
  const isDuplex = this instanceof Stream.Duplex;
                        ^

TypeError: Right-hand side of 'instanceof' is not an object
    at Gunzip.Readable (internal/streams/readable.js:193:25)
    at Gunzip.Duplex (internal/streams/duplex.js:56:12)
    at Gunzip.Transform (internal/streams/transform.js:117:10)
    at Gunzip.ZlibBase (zlib.js:271:13)
    at Gunzip.Zlib (zlib.js:669:12)
    at new Gunzip (zlib.js:732:8)
    at syncBufferWrapper (zlib.js:765:29)
    at Object.<anonymous> (/home/ledion/workspaces/js2bin/gunzip.js:2:13)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)

The regression seems to have been introduced in 14.15.2 and is present in 14.15.3.

Maybe related to #35239? cc @mcollina

@ledbit
Copy link
Author

ledbit commented Dec 24, 2020

Quick update. The following code seems to work - ie it seems like stream is not correctly initialized

$ cat gunzip.js 
const stream = require('stream');   // <==== adding this makes things work
const { gunzipSync } = require('zlib');
console.log(gunzipSync('fooobar'))

@ledbit ledbit changed the title gunzipSync DOA in Node 14.15.3 gunzipSync DOA in Node 14.15.2 Dec 24, 2020
@mcollina mcollina self-assigned this Dec 24, 2020
@mcollina
Copy link
Member

This will be fixed when #36618 is backported to v14.

@targos targos added confirmed-bug Issues with confirmed bugs. zlib Issues and PRs related to the zlib subsystem. labels Dec 27, 2020
@targos targos linked a pull request Dec 28, 2020 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. zlib Issues and PRs related to the zlib subsystem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants