1
0
Fork 0
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:
Tim van der Meij 2022-01-15 14:11:47 +01:00 committed by GitHub
commit 922dac035c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 268 additions and 0 deletions

View file

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