From f6fe788693dedf61407c62a01c64ad6d8a3246e3 Mon Sep 17 00:00:00 2001 From: codedread Date: Fri, 8 Mar 2019 08:19:37 -0800 Subject: [PATCH] If there are not at least ten bytes in the arraybuffer, return a null unarchiver --- archive/archive.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/archive/archive.js b/archive/archive.js index e5746de..22657b5 100644 --- a/archive/archive.js +++ b/archive/archive.js @@ -343,6 +343,10 @@ bitjs.archive.Untarrer = class extends bitjs.archive.Unarchiver { * @return {bitjs.archive.Unarchiver} */ bitjs.archive.GetUnarchiver = function(ab, opt_pathToBitJS) { + if (ab.byteLength < 10) { + return null; + } + let unarchiver = null; const pathToBitJS = opt_pathToBitJS || ''; const h = new Uint8Array(ab, 0, 10);