summaryrefslogtreecommitdiff
path: root/starmath/inc
diff options
context:
space:
mode:
Diffstat (limited to 'starmath/inc')
-rw-r--r--starmath/inc/parse.hxx18
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;