mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 14:48:08 +02:00
Improve /Page validation for linearized documents (issue 18138)
The referenced PDF document contains corrupt linearization-data, that doesn't point to the *first* page as intended.
This commit is contained in:
parent
2a52fda11b
commit
3afa9bfc42
3 changed files with 14 additions and 1 deletions
|
@ -1576,7 +1576,10 @@ class PDFDocument {
|
|||
if (type instanceof Ref) {
|
||||
type = await xref.fetchAsync(type);
|
||||
}
|
||||
if (isName(type, "Page") || (!obj.has("Type") && !obj.has("Kids"))) {
|
||||
if (
|
||||
isName(type, "Page") ||
|
||||
(!obj.has("Type") && !obj.has("Kids") && obj.has("Contents"))
|
||||
) {
|
||||
if (!catalog.pageKidsCountCache.has(ref)) {
|
||||
catalog.pageKidsCountCache.put(ref, 1); // Cache the Page reference.
|
||||
}
|
||||
|
|
1
test/pdfs/issue18138.pdf.link
Normal file
1
test/pdfs/issue18138.pdf.link
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/mozilla/pdf.js/files/15398373/2.pdf
|
|
@ -5438,6 +5438,15 @@
|
|||
"lastPage": 1,
|
||||
"type": "eq"
|
||||
},
|
||||
{
|
||||
"id": "issue18138",
|
||||
"file": "pdfs/issue18138.pdf",
|
||||
"md5": "06136495b2dee5faed2e87c4e49d17fd",
|
||||
"rounds": 1,
|
||||
"link": true,
|
||||
"lastPage": 1,
|
||||
"type": "eq"
|
||||
},
|
||||
{
|
||||
"id": "issue4890",
|
||||
"file": "pdfs/issue4890.pdf",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue