summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2023-09-20 22:20:55 +0200
committerAlbert Astals Cid <aacid@kde.org>2023-09-20 22:20:55 +0200
commite899dc75eb692f7496b9b4d683916c3626eadc02 (patch)
treee2d2fe729d6f8e4fc62fe06ac1d8c390b5f2cabc
parent8ba682b1a5d53efe975849a260e78715da74263c (diff)
FontInfoScanner::scanFonts: Fix infinite recursion on broken files
-rw-r--r--poppler/FontInfo.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/poppler/FontInfo.cc b/poppler/FontInfo.cc
index 551b98a1..a7d105ec 100644
--- a/poppler/FontInfo.cc
+++ b/poppler/FontInfo.cc
@@ -129,7 +129,11 @@ void FontInfoScanner::scanFonts(XRef *xrefA, Dict *resDict, std::vector<FontInfo
// resource dictionary
const char *resTypes[] = { "XObject", "Pattern" };
for (const char *resType : resTypes) {
- Object objDict = resDict->lookup(resType);
+ Ref objDictRef;
+ Object objDict = resDict->lookup(resType, &objDictRef);
+ if (!visitedObjects.insert(objDictRef)) {
+ continue;
+ }
if (objDict.isDict()) {
for (int i = 0; i < objDict.dictGetLength(); ++i) {
Ref obj2Ref;