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

zlib deflateraw crash in readable stream in 14.15.2+ #37021

Closed
username-II opened this issue Jan 22, 2021 · 5 comments
Closed

zlib deflateraw crash in readable stream in 14.15.2+ #37021

username-II opened this issue Jan 22, 2021 · 5 comments
Labels
stream Issues and PRs related to the stream subsystem. zlib Issues and PRs related to the zlib subsystem.

Comments

@username-II
Copy link

username-II commented Jan 22, 2021

  • Version: 14.15.2 to 14.15.4 nodejs both win32/64
  • Platform: win10 pro 64b 19042.746
  • Subsystem: internal zlib/streams

What steps will reproduce the bug?

Save the following code into a file: zliberr.js
let squished =require("zlib").deflateRawSync(Buffer.from(JSON.stringify(process.versions),'utf8'), {level:9}); /* bang in the following on node v14.15.2+ */ console.log(require("zlib").inflateRawSync(squished).toString());
run: node zliberr.js
// above code display ignores CRs?

How often does it reproduce? Is there a required condition?

Nicely repeatable when run as source.
But works when run from the node CLI as separate pasted code lines.

What is the expected behavior?

OK result: equal or earlier than v14.15.1
{"node":"14.15.1","v8":"8.4.371.19-node.17","uv":"1.40.0","zlib":"1.2.11","brotli":"1.0.9","ares":"1.16.1","modules":"83","nghttp2":"1.41.0","napi":"7","llhttp":"2.1.3","openssl":"1.1.1g","cldr":"37.0","icu":"67.1","tz":"2020a","unicode":"13.0"}

What do you see instead?

ERROR result: from v14.15.2+
internal/streams/readable.js:193 const isDuplex = this instanceof Stream.Duplex; ^ TypeError: Right-hand side of 'instanceof' is not an object ←[90m at DeflateRaw.Readable (internal/streams/readable.js:193:25)←[39m ←[90m at DeflateRaw.Duplex (internal/streams/duplex.js:56:12)←[39m ←[90m at DeflateRaw.Transform (internal/streams/transform.js:117:10)←[39m ←[90m at DeflateRaw.ZlibBase (zlib.js:271:13)←[39m ←[90m at DeflateRaw.Zlib (zlib.js:669:12)←[39m ←[90m at new DeflateRaw (zlib.js:741:8)←[39m ←[90m at Object.syncBufferWrapper [as deflateRawSync] (zlib.js:765:29)←[39m at Object.<anonymous> (c:\work\projects\source\zlibErr.js:1:31) ←[90m at Module._compile (internal/modules/cjs/loader.js:1063:30)←[39m ←[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)←[39m

Additional information

I have used this feature for many years and seems broken in the latest 14.15.4 LTS. The 12.* line seems fine and I have not tried 15.*

@richardlau
Copy link
Member

cc @nodejs/streams

@username-II
Copy link
Author

15.6.0 seems OK

@richardlau
Copy link
Member

richardlau commented Jan 22, 2021

I think this is #36615 and #36618 needs to land in v14.x.

@mcollina
Copy link
Member

yes, exactly.

For anyone that reads this, adding a require('stream') at the beginning of the script fixes this.

@targos targos added stream Issues and PRs related to the stream subsystem. zlib Issues and PRs related to the zlib subsystem. v14.x labels Jan 23, 2021
@lpinca
Copy link
Member

lpinca commented Mar 5, 2021

I'm closing this as #36618 landed in v14.15.5.

@lpinca lpinca closed this as completed Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stream Issues and PRs related to the stream subsystem. zlib Issues and PRs related to the zlib subsystem.
Projects
None yet
Development

No branches or pull requests

5 participants