Ignore invalid /CIDToGIDMap-entries when parsing fonts (issue 15139)
In the referenced PDF document the fonts have /CIDToGIDMap-entries that cannot be loaded. Hence, only when `ignoreErrors` is set, we'll now ignore these corrupt /CIDToGIDMap-entries and fallback to simply assume that no such data is available. Given that this is *clearly* a case of a corrupt PDF document, there's no guarantee that this will "fix" things in the general case since a /CIDToGIDMap may be *required* in order for some composite fonts to render correctly. However, attempting to render *something* is surely better than skipping a font altogether.
This commit is contained in:
parent
7a4b72ed11
commit
60bd9580e2
@ -3373,9 +3373,16 @@ class PartialEvaluator {
|
||||
};
|
||||
}
|
||||
|
||||
const cidToGidMap = dict.get("CIDToGIDMap");
|
||||
if (cidToGidMap instanceof BaseStream) {
|
||||
cidToGidBytes = cidToGidMap.getBytes();
|
||||
try {
|
||||
const cidToGidMap = dict.get("CIDToGIDMap");
|
||||
if (cidToGidMap instanceof BaseStream) {
|
||||
cidToGidBytes = cidToGidMap.getBytes();
|
||||
}
|
||||
} catch (ex) {
|
||||
if (!this.options.ignoreErrors) {
|
||||
throw ex;
|
||||
}
|
||||
warn(`extractDataStructures - ignoring CIDToGIDMap data: "${ex}".`);
|
||||
}
|
||||
}
|
||||
|
||||
|
1
test/pdfs/issue15139.pdf.link
Normal file
1
test/pdfs/issue15139.pdf.link
Normal file
@ -0,0 +1 @@
|
||||
https://github.com/mozilla/pdf.js/files/9137443/sample4a.pdf
|
@ -4980,6 +4980,14 @@
|
||||
"lastPage": 1,
|
||||
"type": "eq"
|
||||
},
|
||||
{ "id": "issue15139",
|
||||
"file": "pdfs/issue15139.pdf",
|
||||
"md5": "0f2beb6a788d1e47bb9af737f6670493",
|
||||
"rounds": 1,
|
||||
"link": true,
|
||||
"lastPage": 1,
|
||||
"type": "eq"
|
||||
},
|
||||
{ "id": "gesamt",
|
||||
"file": "pdfs/gesamt.pdf",
|
||||
"md5": "743aaa6f46ed0a42864f079d632d942e",
|
||||
|
Loading…
Reference in New Issue
Block a user