From 293eb15eab3bc3ec2920032a3886adda5b6cc860 Mon Sep 17 00:00:00 2001 From: Kirill Zhumarin Date: Fri, 23 Aug 2024 07:59:19 +0000 Subject: [PATCH] add additional checks --- src/xbz.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/xbz.js b/src/xbz.js index 158cc97..74ca79e 100644 --- a/src/xbz.js +++ b/src/xbz.js @@ -166,9 +166,11 @@ export function convertXbzToFlash(buffer) { finished = decompressor(buffer.subarray(w.offset, w.offset + w.size)); if (!finished) throw new Error(`Unexpected EOF.`); - } else { + } else if (xbz.compressionType == 0) { for (let w of xbz.writes) writeFlash(w.addr, buffer.subarray(w.offset, w.offset + w.size)); + } else { + throw new Error(`Unknown compression type: ${xbz.compressionType}`); } return flash;