From a28d0181cb155d3068415d8d7a6109e11d5fc241 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=BDubor=20Illek?= Date: Mon, 14 Jan 2019 17:54:51 +0100 Subject: [PATCH] Check return code of inflateSetDictionary() --- lib/inflate.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/inflate.js b/lib/inflate.js index 104def2..7535d15 100644 --- a/lib/inflate.js +++ b/lib/inflate.js @@ -153,7 +153,12 @@ function Inflate(options) { } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') { opt.dictionary = new Uint8Array(opt.dictionary); } - if (opt.raw) zlib_inflate.inflateSetDictionary(this.strm, opt.dictionary); //In raw mode we need to set the dictionary early + if (opt.raw) { //In raw mode we need to set the dictionary early + status = zlib_inflate.inflateSetDictionary(this.strm, opt.dictionary); + if (status !== c.Z_OK) { + throw new Error(msg[status]); + } + } } }