aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDFOutlineDocumentHelper.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2021-02-10 22:26:32 +0100
committerJay Berkenbilt <ejb@ql.org>2021-02-10 22:27:44 +0100
commit9fcf61b2f6e9f6670c5ef7103242b4640712dd4f (patch)
tree26183aa43750f3d2b8092db3fc4e4092ef88a88c /libqpdf/QPDFOutlineDocumentHelper.cc
parent4d1f2fdcac8ee8734be02f2c2389c587bc3fc474 (diff)
downloadqpdf-9fcf61b2f6e9f6670c5ef7103242b4640712dd4f.tar.zst
Fix loop in QPDFOutlineDocumentHelper (fuzz issue 30507)
Diffstat (limited to 'libqpdf/QPDFOutlineDocumentHelper.cc')
-rw-r--r--libqpdf/QPDFOutlineDocumentHelper.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/libqpdf/QPDFOutlineDocumentHelper.cc b/libqpdf/QPDFOutlineDocumentHelper.cc
index 85aff76b..b5b82a29 100644
--- a/libqpdf/QPDFOutlineDocumentHelper.cc
+++ b/libqpdf/QPDFOutlineDocumentHelper.cc
@@ -24,8 +24,15 @@ QPDFOutlineDocumentHelper::QPDFOutlineDocumentHelper(QPDF& qpdf) :
return;
}
QPDFObjectHandle cur = outlines.getKey("/First");
+ std::set<QPDFObjGen> seen;
while (! cur.isNull())
{
+ auto og = cur.getObjGen();
+ if (seen.count(og))
+ {
+ break;
+ }
+ seen.insert(og);
this->m->outlines.push_back(
QPDFOutlineObjectHelper::Accessor::create(cur, *this, 1));
cur = cur.getKey("/Next");