1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 09:38:06 +02:00

Adjust incorrect first obj number of "free" xref entry in XRef_readXRefTable (issue 7229)

Fixes 7229.
This commit is contained in:
Jonas Jenwald 2016-04-21 15:10:40 +02:00
parent 2001953871
commit e281ef15db
4 changed files with 15 additions and 6 deletions

View file

@ -736,6 +736,12 @@ var XRef = (function XRefClosure() {
error('Invalid entry in XRef subsection: ' + first + ', ' + count);
}
// The first xref table entry, i.e. obj 0, should be free. Attempting
// to adjust an incorrect first obj # (fixes issue 3248 and 7229).
if (i === 0 && entry.free && first === 1) {
first = 0;
}
if (!this.entries[i + first]) {
this.entries[i + first] = entry;
}
@ -749,12 +755,6 @@ var XRef = (function XRefClosure() {
delete tableState.entryCount;
}
// Per issue 3248: hp scanners generate bad XRef
if (first === 1 && this.entries[1] && this.entries[1].free) {
// shifting the entries
this.entries.shift();
}
// Sanity check: as per spec, first object must be free
if (this.entries[0] && !this.entries[0].free) {
error('Invalid XRef table: unexpected first object');