1
0
Fork 0
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:
Jonas Jenwald 2024-05-22 11:54:11 +02:00
parent 2a52fda11b
commit 3afa9bfc42
3 changed files with 14 additions and 1 deletions

View file

@ -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.
}

View file

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

View file

@ -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",