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

This commit is contained in:
Garret Premo 2022-08-08 14:23:27 -04:00
parent fdbbf2d6bf
commit aea2157036

View File

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