diff --git a/src/core/evaluator.js b/src/core/evaluator.js index 1257a02eb2fca..5e794a66b6b9c 100644 --- a/src/core/evaluator.js +++ b/src/core/evaluator.js @@ -1062,7 +1062,13 @@ class PartialEvaluator { var fontCapability = createPromiseCapability(); - var preEvaluatedFont = this.preEvaluateFont(font); + let preEvaluatedFont; + try { + preEvaluatedFont = this.preEvaluateFont(font); + } catch (reason) { + warn(`loadFont - ignoring preEvaluateFont errors: "${reason}".`); + return errorFont(); + } const { descriptor, hash } = preEvaluatedFont; var fontRefIsRef = isRef(fontRef), @@ -3258,6 +3264,9 @@ class PartialEvaluator { } dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df; + if (!(dict instanceof Dict)) { + throw new FormatError("Descendant font is not a dictionary."); + } type = dict.get("Subtype"); if (!isName(type)) { throw new FormatError("invalid font Subtype"); diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index b81f2b0f68541..6e52ba6968159 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -70,6 +70,7 @@ !issue8570.pdf !issue8697.pdf !issue8702.pdf +!issue12823.pdf !issue8707.pdf !issue8798r.pdf !issue8823.pdf diff --git a/test/pdfs/issue12823.pdf b/test/pdfs/issue12823.pdf new file mode 100644 index 0000000000000..ac70a1711fe45 Binary files /dev/null and b/test/pdfs/issue12823.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index a6c608ff0d08d..8ef927167c0c9 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -1163,6 +1163,12 @@ "link": false, "type": "eq" }, + { "id": "issue12823", + "file": "pdfs/issue12823.pdf", + "md5": "8391c63006ccc4b41c95de5e8c38deeb", + "rounds": 1, + "type": "eq" + }, { "id": "bug1050040", "file": "pdfs/bug1050040.pdf", "md5": "9076b29bd157e2646b457f29a4472a07",