[poppler] poppler/PSOutputDev.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Apr 14 07:15:36 UTC 2021


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

New commits:
commit be9960e86db051a4eabf30e0ab216168b8ce7b59
Author: Albert Astals Cid <aacid at kde.org>
Date:   Wed Apr 14 00:02:11 2021 +0200

    PSOutputDev::setupResources: Fix infinite recursion call on broken files
    
    Issue #1065

diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index bb50080a..9ce6648f 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -1828,8 +1828,17 @@ void PSOutputDev::setupResources(Dict *resDict)
                 // process the XObject's resource dictionary
                 Object xObj = xObjDict.dictGetVal(i);
                 if (xObj.isStream()) {
-                    Object resObj = xObj.streamGetDict()->lookup("Resources");
+                    Ref resObjRef;
+                    Object resObj = xObj.streamGetDict()->lookup("Resources", &resObjRef);
                     if (resObj.isDict()) {
+                        if (resObjRef != Ref::INVALID()) {
+                            const int numObj = resObjRef.num;
+                            if (resourceIDs.find(numObj) != resourceIDs.end()) {
+                                error(errSyntaxError, -1, "loop in Resources (numObj: {0:d})", numObj);
+                                continue;
+                            }
+                            resourceIDs.insert(numObj);
+                        }
                         setupResources(resObj.getDict());
                     }
                 }


More information about the poppler mailing list