You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
zlib deflateraw crash in readable stream in 14.15.2+ #37021
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.*
Activity
richardlau commentedon Jan 22, 2021
cc @nodejs/streams
username-II commentedon Jan 22, 2021
15.6.0 seems OK
richardlau commentedon Jan 22, 2021
I think this is #36615 and #36618 needs to land in v14.x.
mcollina commentedon Jan 22, 2021
yes, exactly.
For anyone that reads this, adding a
require('stream')at the beginning of the script fixes this.lpinca commentedon Mar 5, 2021
I'm closing this as #36618 landed in v14.15.5.