diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-08-01 15:05:45 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2018-08-10 10:57:03 +0200 |
commit | 6fba5e2583e6aa58274b01811c4cf7996d910af7 (patch) | |
tree | 2784943602ef1e44715151e6142d635a0f629211 /include | |
parent | b1bfca0c2ce4629fda5cc8e9ecc69c752e312fca (diff) |
forcepoint#66 protect against infinite parse recurse
Change-Id: I0313cc141469a00b7d6a5bd15400e9d5a8f686cf
Reviewed-on: https://gerrit.libreoffice.org/58452
Tested-by: Jenkins
Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
(cherry picked from commit 171657a1f675268839526b1a13e5f3549fb73516)
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 697751b7f94d..f06049e55c30 100644 --- a/include/vcl/filter/pdfdocument.hxx +++ b/include/vcl/filter/pdfdocument.hxx @@ -38,9 +38,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. @@ -50,7 +62,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; @@ -110,9 +121,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. |