Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2020-04-24 22:12:32 +0300
committerAnna Henningsen <anna@addaleax.net>2020-05-09 08:54:38 +0300
commitb8ed2a07d39785880647c2f4adfb95a7322600cb (patch)
tree5aa1c037fe8acb9f30a98645d346c5130e1de03a /src/node_zlib.cc
parent3226731dec5a82fc2276b571e8c4024b6154de1e (diff)
src: fix invalid windowBits=8 gzip segfault
`{ windowBits: 8 }` is legal for deflate streams but not gzip streams. Fix a nullptr dereference when formatting the error message. Bug introduced in commit c34eae5f88 ("zlib: refactor zlib internals") from September 2018. PR-URL: https://github.com/nodejs/node/pull/33045 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: David Carlier <devnexen@gmail.com>
Diffstat (limited to 'src/node_zlib.cc')
-rw-r--r--src/node_zlib.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/node_zlib.cc b/src/node_zlib.cc
index eacd710143a..83698bd5192 100644
--- a/src/node_zlib.cc
+++ b/src/node_zlib.cc
@@ -111,7 +111,12 @@ enum node_zlib_mode {
struct CompressionError {
CompressionError(const char* message, const char* code, int err)
- : message(message), code(code), err(err) {}
+ : message(message),
+ code(code),
+ err(err) {
+ CHECK_NOT_NULL(message);
+ }
+
CompressionError() = default;
const char* message = nullptr;
@@ -997,7 +1002,7 @@ CompressionError ZlibContext::Init(
if (err_ != Z_OK) {
dictionary_.clear();
mode_ = NONE;
- return ErrorForMessage(nullptr);
+ return ErrorForMessage("zlib error");
}
return SetDictionary();