diff --git a/src/node_zlib.cc b/src/node_zlib.cc index 33da7f6d639..5c94776fa57 100644 --- a/src/node_zlib.cc +++ b/src/node_zlib.cc @@ -1289,6 +1289,11 @@ bool ZlibContext::InitZlib() { return false; } + // If deflateInit2() fails with Z_VERSION_ERROR, msg remains uninitialized. + // Initialize it here to avoid reading the uninitialized pointer during error + // emission. + strm_.msg = nullptr; + switch (mode_) { case DEFLATE: case GZIP: