diff options
-rw-r--r-- | poppler/PSOutputDev.cc | 7 |
1 files changed, 6 insertions, 1 deletions
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()); } } |