Merge pull request #7233 from Snuffleupagus/issue-7229
Adjust incorrect first obj number of "free" xref entry in `XRef_readXRefTable` (issue 7229)
This commit is contained in:
commit
d5c000850a
@ -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');
|
||||
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -24,6 +24,7 @@
|
||||
!issue7101.pdf
|
||||
!issue7115.pdf
|
||||
!issue7200.pdf
|
||||
!issue7229.pdf
|
||||
!filled-background.pdf
|
||||
!ArabicCIDTrueType.pdf
|
||||
!ThuluthFeatures.pdf
|
||||
|
1
test/pdfs/issue3248.pdf.link
Normal file
1
test/pdfs/issue3248.pdf.link
Normal file
@ -0,0 +1 @@
|
||||
http://web.archive.org/web/20130203135942/http://www.kira-reviews.com/wp-content/uploads/2013/01/Scan0003.pdf
|
BIN
test/pdfs/issue7229.pdf
Normal file
BIN
test/pdfs/issue7229.pdf
Normal file
Binary file not shown.
@ -1240,6 +1240,14 @@
|
||||
"lastPage": 1,
|
||||
"type": "load"
|
||||
},
|
||||
{ "id": "issue3248",
|
||||
"file": "pdfs/issue3248.pdf",
|
||||
"md5": "970767ed68de46c316d74de67965999b",
|
||||
"rounds": 1,
|
||||
"link": true,
|
||||
"lastPage": 1,
|
||||
"type": "load"
|
||||
},
|
||||
{ "id": "pr4897",
|
||||
"file": "pdfs/pr4897.pdf",
|
||||
"md5": "26897633eea5e6d10345a130b1c1777c",
|
||||
@ -1248,6 +1256,14 @@
|
||||
"lastPage": 1,
|
||||
"type": "eq"
|
||||
},
|
||||
{ "id": "issue7229",
|
||||
"file": "pdfs/issue7229.pdf",
|
||||
"md5": "480e51aae0ac271780e4603d1561d15e",
|
||||
"rounds": 1,
|
||||
"link": false,
|
||||
"lastPage": 1,
|
||||
"type": "load"
|
||||
},
|
||||
{ "id": "issue1940",
|
||||
"file": "pdfs/issue1940.pdf",
|
||||
"md5": "4f0a0b92c1b5e6e86e1a82490087e6e5",
|
||||
|
Loading…
x
Reference in New Issue
Block a user