summaryrefslogtreecommitdiff
path: root/sw/source/filter/html/swhtml.hxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-01-10 09:33:38 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-01-10 13:57:13 +0100
commit80074e280d95f0f72b8ba7fd8516203f6a2b7d5f (patch)
tree1778cc867890d18279190fac2a2910427ce840b3 /sw/source/filter/html/swhtml.hxx
parentdd758f54fa5ea1ecd3d793bcea999d771010ff00 (diff)
ofz#5211 limit table parsing depth
Change-Id: I77b569faacc6f2655b050d09a236f78843e87560 Reviewed-on: https://gerrit.libreoffice.org/47691 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source/filter/html/swhtml.hxx')
-rw-r--r--sw/source/filter/html/swhtml.hxx19
1 files changed, 19 insertions, 0 deletions
diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx
index 1be17ff43d78..c86150510428 100644
--- a/sw/source/filter/html/swhtml.hxx
+++ b/sw/source/filter/html/swhtml.hxx
@@ -493,6 +493,8 @@ class SwHTMLParser : public SfxHTMLParser, public SwClient
bool m_bBodySeen : 1;
bool m_bReadingHeaderOrFooter : 1;
+ sal_Int32 m_nTableDepth;
+
/// the names corresponding to the DOCINFO field subtypes INFO[1-4]
OUString m_InfoNames[4];
@@ -881,6 +883,23 @@ private:
bool PendingObjectsInPaM(SwPaM& rPam) const;
+ class TableDepthGuard
+ {
+ private:
+ SwHTMLParser& m_rParser;
+ public:
+ TableDepthGuard(SwHTMLParser& rParser)
+ : m_rParser(rParser)
+ {
+ ++m_rParser.m_nTableDepth;
+ }
+ bool TooDeep() const { return m_rParser.m_nTableDepth > 2048; }
+ ~TableDepthGuard()
+ {
+ --m_rParser.m_nTableDepth;
+ }
+ };
+
public: // used in tables
// Create brush item (with new) or 0