aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/parsing/Parser.h
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-08-15 00:59:17 +0800
committerchriseth <chris@ethereum.org>2017-08-15 04:19:15 +0800
commit32e43477c336c9180eedd6ad968595e33ecde704 (patch)
treea0c3b63ca9519132c9da8aa0fd229b66dd99aa55 /libsolidity/parsing/Parser.h
parentbcce31b548870c323747085676f118b5b46ed234 (diff)
downloaddexon-solidity-32e43477c336c9180eedd6ad968595e33ecde704.tar.gz
dexon-solidity-32e43477c336c9180eedd6ad968595e33ecde704.tar.zst
dexon-solidity-32e43477c336c9180eedd6ad968595e33ecde704.zip
Prevent too deep recursion in parser.
Diffstat (limited to 'libsolidity/parsing/Parser.h')
-rw-r--r--libsolidity/parsing/Parser.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/libsolidity/parsing/Parser.h b/libsolidity/parsing/Parser.h
index 97e60baa..5e6f3ef6 100644
--- a/libsolidity/parsing/Parser.h
+++ b/libsolidity/parsing/Parser.h
@@ -41,6 +41,7 @@ public:
private:
class ASTNodeFactory;
+ class RecursionGuard;
struct VarDeclParserOptions
{
@@ -164,8 +165,14 @@ private:
/// Creates an empty ParameterList at the current location (used if parameters can be omitted).
ASTPointer<ParameterList> createEmptyParameterList();
+ /// Increases the recursion depth and throws an exception if it is too deep.
+ void increaseRecursionDepth();
+ void decreaseRecursionDepth();
+
/// Flag that signifies whether '_' is parsed as a PlaceholderStatement or a regular identifier.
bool m_insideModifier = false;
+ /// Current recursion depth during parsing.
+ size_t m_recursionDepth = 0;
};
}