diff --git a/src/core/type1_font.js b/src/core/type1_font.js index 3ff2240c5..10ff3aeb8 100644 --- a/src/core/type1_font.js +++ b/src/core/type1_font.js @@ -24,11 +24,11 @@ import { CFFStrings, CFFTopDict, } from "./cff_parser.js"; +import { FormatError, warn } from "../shared/util.js"; import { SEAC_ANALYSIS_ENABLED, type1FontGlyphMapping } from "./fonts_utils.js"; import { isWhiteSpace } from "./core_utils.js"; import { Stream } from "./stream.js"; import { Type1Parser } from "./type1_parser.js"; -import { warn } from "../shared/util.js"; function findBlock(streamBytes, signature, startIndex) { const streamBytesLength = streamBytes.length; @@ -140,6 +140,9 @@ function getEexecBlock(stream, suggestedLength) { // in the returned eexec block. In practice this does *not* seem to matter, // since `Type1Parser_extractFontProgram` will skip over any non-commands. const eexecBytes = stream.getBytes(); + if (eexecBytes.length === 0) { + throw new FormatError("getEexecBlock - no font program found."); + } return { stream: new Stream(eexecBytes), length: eexecBytes.length, diff --git a/test/pdfs/issue15292.pdf.link b/test/pdfs/issue15292.pdf.link new file mode 100644 index 000000000..b4401058f --- /dev/null +++ b/test/pdfs/issue15292.pdf.link @@ -0,0 +1 @@ +https://github.com/mozilla/pdf.js/files/9288663/issue15292.pdf diff --git a/test/test_manifest.json b/test/test_manifest.json index 186bfae2a..f577e88a7 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -153,6 +153,14 @@ "lastPage": 1, "type": "eq" }, + { "id": "issue15292", + "file": "pdfs/issue15292.pdf", + "md5": "24297e183bf16cdd684dac8902e9fbe6", + "rounds": 1, + "link": true, + "lastPage": 1, + "type": "eq" + }, { "id": "issue11549", "file": "pdfs/issue11549_reduced.pdf", "md5": "a1ea636f413e02e10dbdf379ab4a99ae",