From dbe29307588e0c23e19c3f02d9390e406aa422cc 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 --- kasmweb/core/inflator.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kasmweb/core/inflator.js b/kasmweb/core/inflator.js index 726600f..39db447 100644 --- a/kasmweb/core/inflator.js +++ b/kasmweb/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");