diff options
author | chriseth <chris@ethereum.org> | 2017-08-21 18:33:29 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2017-08-22 18:44:22 +0800 |
commit | 692e4c57e83607f21d0c1b1b735585b3b63564f3 (patch) | |
tree | 91d8ba9a3d9293282611505380f9040fb527ef1c /libsolidity/parsing/ParserBase.cpp | |
parent | 97cb571ba49b81bd20b840e20f27c2cf55730d81 (diff) | |
download | dexon-solidity-692e4c57e83607f21d0c1b1b735585b3b63564f3.tar.gz dexon-solidity-692e4c57e83607f21d0c1b1b735585b3b63564f3.tar.zst dexon-solidity-692e4c57e83607f21d0c1b1b735585b3b63564f3.zip |
Check recursion depth in assembly parser.
Diffstat (limited to 'libsolidity/parsing/ParserBase.cpp')
-rw-r--r-- | libsolidity/parsing/ParserBase.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libsolidity/parsing/ParserBase.cpp b/libsolidity/parsing/ParserBase.cpp index 5657c2c0..db988739 100644 --- a/libsolidity/parsing/ParserBase.cpp +++ b/libsolidity/parsing/ParserBase.cpp @@ -101,6 +101,19 @@ void ParserBase::expectToken(Token::Value _value) m_scanner->next(); } +void ParserBase::increaseRecursionDepth() +{ + m_recursionDepth++; + if (m_recursionDepth >= 4096) + fatalParserError("Maximum recursion depth reached during parsing."); +} + +void ParserBase::decreaseRecursionDepth() +{ + solAssert(m_recursionDepth > 0, ""); + m_recursionDepth--; +} + void ParserBase::parserError(string const& _description) { m_errorReporter.parserError(SourceLocation(position(), position(), sourceName()), _description); |