poppler/FontInfo.cc |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 8051f678b3b43326e5fdfd7c03f39de21059f426
Author: Albert Astals Cid <[email protected]>
Date:   Fri Apr 5 16:34:48 2019 +0200

    FontInfoScanner::scanFonts Fix infinite loop in broken files
    
    Fixes #752

diff --git a/poppler/FontInfo.cc b/poppler/FontInfo.cc
index 2c3be4c6..cd335771 100644
--- a/poppler/FontInfo.cc
+++ b/poppler/FontInfo.cc
@@ -144,7 +144,17 @@ void FontInfoScanner::scanFonts(XRef *xrefA, Dict 
*resDict, std::vector<FontInfo
 
         Object obj2 = dictObjI.fetch(xrefA);
         if (obj2.isStream()) {
-          Object resObj = obj2.streamGetDict()->lookup("Resources");
+          Ref resourcesRef;
+          const Object resObj = obj2.streamGetDict()->lookup("Resources", 
&resourcesRef);
+
+          if (resourcesRef != Ref::INVALID()) {
+            if (visitedObjects.find(resourcesRef.num) != visitedObjects.end()) 
{
+              continue;
+            }
+
+            visitedObjects.insert(resourcesRef.num);
+          }
+
           if (resObj.isDict() && resObj.getDict() != resDict) {
             scanFonts(xrefA, resObj.getDict(), fontsList);
           }
_______________________________________________
poppler mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to