From 3cf11004b476b66296714e0d7b85437d40604cc3 Mon Sep 17 00:00:00 2001 From: Niko Lehto Date: Mon, 3 Feb 2020 10:04:20 +0100 Subject: [PATCH] Handle errors from zlib/pako --- core/inflator.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/inflator.js b/core/inflator.js index 726600f9..39db447a 100644 --- a/core/inflator.js +++ b/core/inflator.js @@ -35,7 +35,10 @@ export default class Inflate { this.strm.avail_out = this.chunkSize; - inflate(this.strm, 0); // Flush argument not used. + let ret = inflate(this.strm, 0); // Flush argument not used. + if (ret < 0) { + throw new Error("zlib inflate failed"); + } if (this.strm.next_out != expected) { throw new Error("Incomplete zlib block");