diff --git a/src/core/document.js b/src/core/document.js index 9ce6b74f14d3c..fe54c53f5cb32 100644 --- a/src/core/document.js +++ b/src/core/document.js @@ -1713,6 +1713,9 @@ class PDFDocument { #collectFieldObjects(name, fieldRef, promises, annotationGlobals) { const field = this.xref.fetchIfRef(fieldRef); + if (!(field instanceof Dict)) { + return; + } if (field.has("T")) { const partName = stringToPDFString(field.get("T")); name = name === "" ? partName : `${name}.${partName}`; @@ -1737,8 +1740,9 @@ class PDFDocument { }) ); - if (field.has("Kids")) { - for (const kid of field.get("Kids")) { + const kids = field.get("Kids"); + if (Array.isArray(kids)) { + for (const kid of kids) { this.#collectFieldObjects(name, kid, promises, annotationGlobals); } } diff --git a/test/pdfs/issue17232.pdf.link b/test/pdfs/issue17232.pdf.link new file mode 100644 index 0000000000000..250e739c96b6f --- /dev/null +++ b/test/pdfs/issue17232.pdf.link @@ -0,0 +1,2 @@ +https://github.com/mozilla/pdf.js/files/13280636/aanvraag-beeindiging-aansluiting.pdf + diff --git a/test/test_manifest.json b/test/test_manifest.json index 4035622bf86b0..bd98b5f995375 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -8197,5 +8197,14 @@ "rounds": 1, "type": "eq", "annotations": true - } + }, + { + "id": "issue17232-annotations", + "file": "pdfs/issue17232.pdf", + "md5": "90ade9fc5721ddf8d17e8cfc43e186a4", + "rounds": 1, + "link": true, + "type": "eq", + "annotations": true + } ]