1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18: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.
}