diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-12-06 10:38:38 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-12-06 17:48:30 +0100 |
commit | 1a658831d86f6dba67f8f3bcd47435d496fe4dfa (patch) | |
tree | 88e4b2521e0deb7d81b41195ae45683b1d8580fc /starmath/inc | |
parent | 495ac1bc97f3deea8e13cb1a2b9f59d087873c3f (diff) |
ofz#4539 depth protect mathtype parser
Change-Id: I46e12f52d56e7802b676309207904b4d1894d236
Reviewed-on: https://gerrit.libreoffice.org/45928
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 'starmath/inc')
-rw-r--r-- | starmath/inc/parse.hxx | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx index 1bcef035d5b2..5d1eeef553d4 100644 --- a/starmath/inc/parse.hxx +++ b/starmath/inc/parse.hxx @@ -41,6 +41,24 @@ class SmParser m_nColOff; // 0-based bool m_bImportSymNames, m_bExportSymNames; + sal_Int32 m_nParseDepth; + + class DepthProtect + { + private: + sal_Int32& m_rParseDepth; + public: + DepthProtect(sal_Int32& rParseDepth) + : m_rParseDepth(rParseDepth) + { + ++m_rParseDepth; + } + bool TooDeep() const { return m_rParseDepth > 2048; } + ~DepthProtect() + { + --m_rParseDepth; + } + }; // map of used symbols (used to reduce file size by exporting only actually used symbols) std::set< OUString > m_aUsedSymbols; |