Skip to content

zlib deflateraw crash in readable stream in 14.15.2+ #37021

@username-II

Description

@username-II
  • 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.*

Metadata

Metadata

Assignees

No one assigned

    Labels

    streamIssues and PRs related to the stream subsystem.zlibIssues and PRs related to the zlib subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions