From aea21570361d7ec03e8ebd84ec3c8b116d31958b Mon Sep 17 00:00:00 2001 From: Garret Premo Date: Mon, 8 Aug 2022 14:23:27 -0400 Subject: [PATCH] Fix an issue where, if a file is corrupted in a specific way, the Record Type check would pass, but the length check would fail --- bits/76_xls.js | 1 + 1 file changed, 1 insertion(+) diff --git a/bits/76_xls.js b/bits/76_xls.js index fc19e07..4546068 100644 --- a/bits/76_xls.js +++ b/bits/76_xls.js @@ -204,6 +204,7 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ { if(RecordType === 0 && last_RT === 0x000a /* EOF */) break; var length = (blob.l === blob.length ? 0 : blob.read_shift(2)); var R = XLSRecordEnum[RecordType]; + if(file_depth == 0 && [0x0009, 0x0209, 0x0409, 0x0809].indexOf(RecordType) == -1 /* BOF */) break; //console.log(RecordType.toString(16), RecordType, R, blob.l, length, blob.length); //if(!R) console.log(blob.slice(blob.l, blob.l + length)); if(R && R.f) {