Check recursion depth in assembly parser.

This commit is contained in:
chriseth
2017-08-22 12:44:22 +02:00
parent 97cb571ba4
commit 692e4c57e8
7 changed files with 46 additions and 40 deletions
+13
View File
@@ -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);