summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-08-01 19:25:27 +0100
committerAndras Timar <andras.timar@collabora.com>2018-08-08 13:07:32 +0200
commit6115bf07f03e7779be552d14a62bb7e722daefb5 (patch)
treee354925cde6e19c090277e0cba214ae4c4f6d381
parentdc5261be602b284227be727ba2c6318afd73641a (diff)
forcepoint#66 make sure we don't get stuck endlessly reparsing
Change-Id: Ie2733e8d7f73e5f6a072604c477e949cd944189a Reviewed-on: https://gerrit.libreoffice.org/58466 Tested-by: Jenkins Reviewed-by: Michael Stahl <Michael.Stahl@cib.de> (cherry picked from commit cc8140fe71becc92976167e2a96dbe1d727097dc) (cherry picked from commit fab30b5d512edf8d5252ddde4132b0f310431afd)
-rw-r--r--vcl/source/filter/ipdf/pdfdocument.cxx11
1 files changed, 8 insertions, 3 deletions
diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx b/vcl/source/filter/ipdf/pdfdocument.cxx
index 83560394ba4c..5661e605bee5 100644
--- a/vcl/source/filter/ipdf/pdfdocument.cxx
+++ b/vcl/source/filter/ipdf/pdfdocument.cxx
@@ -2226,9 +2226,14 @@ size_t PDFDictionaryElement::Parse(const std::vector< std::unique_ptr<PDFElement
else if (!pDictionary->alreadyParsing())
{
// Nested dictionary.
- i = PDFDictionaryElement::Parse(rElements, pDictionary, pDictionary->m_aItems);
- rDictionary[aName] = pDictionary;
- aName.clear();
+ const size_t nexti
+ = PDFDictionaryElement::Parse(rElements, pDictionary, pDictionary->m_aItems);
+ if (nexti >= i) // ensure we go forwards and not endlessly loop
+ {
+ i = nexti;
+ rDictionary[aName] = pDictionary;
+ aName.clear();
+ }
}
}