Merge pull request #14270 from Snuffleupagus/issue-14269

When parsing corrupt documents without any trailer-dictionary, fallback to the "top"-dictionary (issue 14269)
This commit is contained in:
Jonas Jenwald 2021-11-13 16:01:28 +01:00 committed by GitHub
commit db41c49321
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 0 deletions

View File

@ -590,6 +590,10 @@ class XRef {
if (trailerDict) {
return trailerDict;
}
// No trailer dictionary found, taking the "top"-dictionary (if exists).
if (this.topDict) {
return this.topDict;
}
// nothing helps
throw new InvalidPDFException("Invalid PDF structure.");
}
@ -680,6 +684,8 @@ class XRef {
throw e;
}
info("(while reading XRef): " + e);
this.startXRefQueue.shift();
}
if (recoveryMode) {

View File

@ -0,0 +1 @@
https://github.com/mozilla/pdf.js/files/7529789/test.pdf

View File

@ -91,6 +91,14 @@
"rounds": 1,
"type": "eq"
},
{ "id": "issue14269",
"file": "pdfs/issue14269.pdf",
"md5": "f34abf77a418f54e13fbcd03b063432e",
"rounds": 1,
"link": true,
"lastPage": 1,
"type": "eq"
},
{ "id": "issue11549",
"file": "pdfs/issue11549_reduced.pdf",
"md5": "a1ea636f413e02e10dbdf379ab4a99ae",