Merge pull request #15397 from Snuffleupagus/getEexecBlock-empty

Fallback to a standard font when a Type1 font program is empty (issue 15292)
This commit is contained in:
Jonas Jenwald 2022-09-06 10:27:37 +02:00 committed by GitHub
commit b4b9ce83ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 1 deletions

View File

@ -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,

View File

@ -0,0 +1 @@
https://github.com/mozilla/pdf.js/files/9288663/issue15292.pdf

View File

@ -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",