[poppler] poppler/PSOutputDev.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Oct 19 19:19:23 UTC 2022


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

New commits:
commit e53f5aae3bce7d09788f2ad62be998895fb9807b
Author: Albert Astals Cid <aacid at kde.org>
Date:   Wed Oct 19 21:15:29 2022 +0200

    PSOutputDev::setupResources: Fix stack overflow in malformed doc
    
    Issue #1304

diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index 66a49f2b..cdabc251 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -1908,8 +1908,13 @@ void PSOutputDev::setupResources(Dict *resDict)
                 // process the Pattern's resource dictionary
                 Object pat = patDict.dictGetVal(i);
                 if (pat.isStream()) {
-                    Object resObj = pat.streamGetDict()->lookup("Resources");
+                    Ref resObjRef;
+                    Object resObj = pat.streamGetDict()->lookup("Resources", &resObjRef);
                     if (resObj.isDict()) {
+                        if (resObjRef != Ref::INVALID() && !resourceIDs.insert(resObjRef.num).second) {
+                            error(errSyntaxWarning, -1, "PSOutputDev::setupResources: Circular resources found.");
+                            continue;
+                        }
                         setupResources(resObj.getDict());
                     }
                 }


More information about the poppler mailing list