diff --git a/src/core/evaluator.js b/src/core/evaluator.js index c906abce5..1600f098a 100644 --- a/src/core/evaluator.js +++ b/src/core/evaluator.js @@ -4436,6 +4436,16 @@ class PartialEvaluator { let glyphScaleFactors = null; let systemFontInfo = null; if (fontFile) { + if (!(fontFile instanceof BaseStream)) { + const msg = `Font file should be a Stream in "${fontName.name}".`; + + if (!this.options.ignoreErrors) { + throw new FormatError(msg); + } + warn(msg); + fontFile = new NullStream(); + } + if (fontFile.dict) { const subtypeEntry = fontFile.dict.get("Subtype"); if (subtypeEntry instanceof Name) { diff --git a/test/pdfs/issue18941.pdf.link b/test/pdfs/issue18941.pdf.link new file mode 100644 index 000000000..d2402e740 --- /dev/null +++ b/test/pdfs/issue18941.pdf.link @@ -0,0 +1 @@ +https://github.com/user-attachments/files/17473385/21_10_2024_FAMI.INVERSION.SAS_901060703_inicial.pdf diff --git a/test/test_manifest.json b/test/test_manifest.json index 749cdf6c8..38698ad8a 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -2352,6 +2352,15 @@ "lastPage": 3, "type": "eq" }, + { + "id": "issue18941", + "file": "pdfs/issue18941.pdf", + "md5": "6288e69c1dd240859c1d49c22a53a5c7", + "rounds": 1, + "link": true, + "lastPage": 1, + "type": "eq" + }, { "id": "f1040", "file": "pdfs/f1040.pdf",