1
0
Fork 0
mirror of https://github.com/codedread/bitjs synced 2025-10-03 17:49:16 +02:00

If there are not at least ten bytes in the arraybuffer, return a null unarchiver

This commit is contained in:
codedread 2019-03-08 08:19:37 -08:00
parent e07990c4db
commit f6fe788693

View file

@ -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);