From a6eadf8150cb4cf2c867b046111d795b1fe3c8e6 Mon Sep 17 00:00:00 2001 From: Calixte Denizet Date: Mon, 19 Feb 2024 09:54:24 +0100 Subject: [PATCH] Avoid to access to a missing cidSystemInfo property Fixes #17689. --- src/core/evaluator.js | 4 +++- test/pdfs/issue17689.pdf.link | 2 ++ test/test_manifest.json | 10 ++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 test/pdfs/issue17689.pdf.link diff --git a/src/core/evaluator.js b/src/core/evaluator.js index 8117828a1116f..32a2ece7a8ab5 100644 --- a/src/core/evaluator.js +++ b/src/core/evaluator.js @@ -3719,7 +3719,9 @@ class PartialEvaluator { properties.composite && ((properties.cMap.builtInCMap && !(properties.cMap instanceof IdentityCMap)) || - (properties.cidSystemInfo.registry === "Adobe" && + // The font is supposed to have a CIDSystemInfo dictionary, but some + // PDFs don't include it (fixes issue 17689), hence the `?'. + (properties.cidSystemInfo?.registry === "Adobe" && (properties.cidSystemInfo.ordering === "GB1" || properties.cidSystemInfo.ordering === "CNS1" || properties.cidSystemInfo.ordering === "Japan1" || diff --git a/test/pdfs/issue17689.pdf.link b/test/pdfs/issue17689.pdf.link new file mode 100644 index 0000000000000..5299c2ff8b261 --- /dev/null +++ b/test/pdfs/issue17689.pdf.link @@ -0,0 +1,2 @@ +https://github.com/mozilla/pdf.js/files/14328616/2023_12_13.pdf + diff --git a/test/test_manifest.json b/test/test_manifest.json index d81f8d21afa7f..37f54ea0bbf43 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -9736,5 +9736,15 @@ "md5": "407695b36b4611bc7c501a891c8a4b28", "rounds": 1, "type": "eq" + }, + { + "id": "issue17689", + "file": "pdfs/issue17689.pdf", + "md5": "2d260d3795e551fa047eef7c3dbab45b", + "rounds": 1, + "link": true, + "firstPage": 2, + "lastPage": 2, + "type": "eq" } ]