From f232f2591b6be35ca3722e8e52fbdf36865a5967 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 1 Aug 2018 15:05:45 +0100 Subject: forcepoint#66 protect against infinite parse recurse Change-Id: I0313cc141469a00b7d6a5bd15400e9d5a8f686cf Reviewed-on: https://gerrit.libreoffice.org/58449 Tested-by: Jenkins Reviewed-by: Michael Stahl --- include/vcl/filter/pdfdocument.hxx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/vcl/filter/pdfdocument.hxx b/include/vcl/filter/pdfdocument.hxx index b19bfca6b408..03180fd0597f 100644 --- a/include/vcl/filter/pdfdocument.hxx +++ b/include/vcl/filter/pdfdocument.hxx @@ -51,9 +51,21 @@ class PDFNumberElement; /// A byte range in a PDF file. class VCL_DLLPUBLIC PDFElement { + bool m_bVisiting; + bool m_bParsing; + public: + PDFElement() + : m_bVisiting(false) + , m_bParsing(false) + { + } virtual bool Read(SvStream& rStream) = 0; virtual ~PDFElement() = default; + void setVisiting(bool bVisiting) { m_bVisiting = bVisiting; } + bool alreadyVisiting() const { return m_bVisiting; } + void setParsing(bool bParsing) { m_bParsing = bParsing; } + bool alreadyParsing() const { return m_bParsing; } }; /// Indirect object: something with a unique ID. @@ -63,7 +75,6 @@ class VCL_DLLPUBLIC PDFObjectElement : public PDFElement PDFDocument& m_rDoc; double m_fObjectValue; double m_fGenerationValue; - bool m_bVisiting; std::map m_aDictionary; /// If set, the object contains this number element (outside any dictionary/array). PDFNumberElement* m_pNumberElement; @@ -123,9 +134,6 @@ public: SvMemoryStream* GetStreamBuffer() const; void SetStreamBuffer(std::unique_ptr& pStreamBuffer); PDFDocument& GetDocument(); - - /// Visits the page tree recursively, looking for page objects. - void visitPages(std::vector& rRet); }; /// Array object: a list. -- cgit