Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(790)

Unified Diff: runtime/vm/parser.h

Issue 1620493002: Parser recursion check (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/parser.cc » ('j') | runtime/vm/parser.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.h
diff --git a/runtime/vm/parser.h b/runtime/vm/parser.h
index edc8fdfd01d88936f8e608bcffc5d97cf73729b1..9d9e50346ca2b5fac395f6ff8635c8f659cdc5fb 100644
--- a/runtime/vm/parser.h
+++ b/runtime/vm/parser.h
@@ -36,6 +36,7 @@ struct MemberDesc;
struct ParamList;
struct QualIdent;
class TopLevel;
+class RecursionChecker;
// The class ParsedFunction holds the result of parsing a function.
class ParsedFunction : public ZoneAllocated {
@@ -365,6 +366,9 @@ class Parser : public ValueObject {
const Function& constructor,
const TypeArguments& type_arguments);
+ // Report error if parsed code is too deeply nested; avoid stack overflow.
+ void CheckStack();
+
// Report already formatted error.
static void ReportError(const Error& error);
@@ -894,6 +898,9 @@ class Parser : public ValueObject {
// Indentation of parser trace.
intptr_t trace_indent_;
+ intptr_t recursion_counter_;
+ friend class RecursionChecker;
+
DISALLOW_COPY_AND_ASSIGN(Parser);
};
« no previous file with comments | « no previous file | runtime/vm/parser.cc » ('j') | runtime/vm/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698