Index: src/parser.cc |
=================================================================== |
--- src/parser.cc (revision 6692) |
+++ src/parser.cc (working copy) |
@@ -333,6 +333,9 @@ |
} |
+const int Parser::kMaxNumFunctionParameters; |
+ |
+ |
Handle<String> Parser::LookupSymbol(int symbol_id) { |
// Length of symbol cache is the number of identified symbols. |
// If we are larger than that, or negative, it's not a cached symbol. |
@@ -3499,6 +3502,12 @@ |
Variable* parameter = top_scope_->DeclareLocal(param_name, Variable::VAR); |
top_scope_->AddParameter(parameter); |
num_parameters++; |
+ if (num_parameters > kMaxNumFunctionParameters) { |
+ ReportMessageAt(scanner().location(), "too_many_parameters", |
+ Vector<const char*>::empty()); |
+ *ok = false; |
+ return NULL; |
+ } |
done = (peek() == Token::RPAREN); |
if (!done) Expect(Token::COMMA, CHECK_OK); |
} |