diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-08-01 15:05:45 +0100 |
---|---|---|
committer | Michael Stahl <Michael.Stahl@cib.de> | 2018-08-03 11:07:53 +0200 |
commit | f232f2591b6be35ca3722e8e52fbdf36865a5967 (patch) | |
tree | 8f847409348770d1a31c603bd855f131f2645976 /include | |
parent | eddfa05b95a43c92a3729d3e416c77016f278f26 (diff) |
forcepoint#66 protect against infinite parse recurse
Change-Id: I0313cc141469a00b7d6a5bd15400e9d5a8f686cf
Reviewed-on: https://gerrit.libreoffice.org/58449
Tested-by: Jenkins
Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/vcl/filter/pdfdocument.hxx | 16 |
1 files changed, 12 insertions, 4 deletions
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<OString, PDFElement*> 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<SvMemoryStream>& pStreamBuffer); PDFDocument& GetDocument(); - - /// Visits the page tree recursively, looking for page objects. - void visitPages(std::vector<PDFObjectElement*>& rRet); }; /// Array object: a list. |