Skip to content

Commit aea2157

Browse files
committed
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
1 parent fdbbf2d commit aea2157

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

bits/76_xls.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
204204
if(RecordType === 0 && last_RT === 0x000a /* EOF */) break;
205205
var length = (blob.l === blob.length ? 0 : blob.read_shift(2));
206206
var R = XLSRecordEnum[RecordType];
207+
if(file_depth == 0 && [0x0009, 0x0209, 0x0409, 0x0809].indexOf(RecordType) == -1 /* BOF */) break;
207208
//console.log(RecordType.toString(16), RecordType, R, blob.l, length, blob.length);
208209
//if(!R) console.log(blob.slice(blob.l, blob.l + length));
209210
if(R && R.f) {

0 commit comments

Comments
 (0)