mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Merge pull request #14448 from Snuffleupagus/Type3-circular-refs
Prevent circular references in Type3 fonts
This commit is contained in:
commit
922dac035c
5 changed files with 268 additions and 0 deletions
|
@ -1155,6 +1155,10 @@ class PartialEvaluator {
|
|||
}
|
||||
}
|
||||
|
||||
if (this.parsingType3Font && this.type3FontRefs.has(fontRef)) {
|
||||
return errorFont();
|
||||
}
|
||||
|
||||
if (this.fontCache.has(fontRef)) {
|
||||
return this.fontCache.get(fontRef);
|
||||
}
|
||||
|
@ -4183,6 +4187,12 @@ class TranslatedFont {
|
|||
// make sense to only be able to render a Type3 glyph partially.
|
||||
const type3Evaluator = evaluator.clone({ ignoreErrors: false });
|
||||
type3Evaluator.parsingType3Font = true;
|
||||
// Prevent circular references in Type3 fonts.
|
||||
const type3FontRefs = new RefSet(evaluator.type3FontRefs);
|
||||
if (this.dict.objId && !type3FontRefs.has(this.dict.objId)) {
|
||||
type3FontRefs.put(this.dict.objId);
|
||||
}
|
||||
type3Evaluator.type3FontRefs = type3FontRefs;
|
||||
|
||||
const translatedFont = this.font,
|
||||
type3Dependencies = this.type3Dependencies;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue