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
@ -1576,7 +1576,10 @@ class PDFDocument {
|
|||||||
if (type instanceof Ref) {
|
if (type instanceof Ref) {
|
||||||
type = await xref.fetchAsync(type);
|
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)) {
|
if (!catalog.pageKidsCountCache.has(ref)) {
|
||||||
catalog.pageKidsCountCache.put(ref, 1); // Cache the Page reference.
|
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,
|
"lastPage": 1,
|
||||||
"type": "eq"
|
"type": "eq"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "issue18138",
|
||||||
|
"file": "pdfs/issue18138.pdf",
|
||||||
|
"md5": "06136495b2dee5faed2e87c4e49d17fd",
|
||||||
|
"rounds": 1,
|
||||||
|
"link": true,
|
||||||
|
"lastPage": 1,
|
||||||
|
"type": "eq"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "issue4890",
|
"id": "issue4890",
|
||||||
"file": "pdfs/issue4890.pdf",
|
"file": "pdfs/issue4890.pdf",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user