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

Unified Diff: src/ast.cc

Issue 7170014: Avoid OOM on regexps with nested quantifiers. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 6 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 | « src/ast.h ('k') | src/jsregexp.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast.cc
===================================================================
--- src/ast.cc (revision 8295)
+++ src/ast.cc (working copy)
@@ -925,6 +925,26 @@
}
+bool RegExpDisjunction::ContainsExpandedQuantifier() {
+ if (contains_expanded_quantifier_) return true;
+ int len = alternatives_->length();
+ for (int i = 0; i < len; i++) {
+ if (alternatives_->at(i)->ContainsExpandedQuantifier()) return true;
+ }
+ return false;
+}
+
+
+bool RegExpAlternative::ContainsExpandedQuantifier() {
+ if (contains_expanded_quantifier_) return true;
+ int len = nodes_->length();
+ for (int i = 0; i < len; i++) {
+ if (nodes_->at(i)->ContainsExpandedQuantifier()) return true;
+ }
+ return false;
+}
+
+
// Convert regular expression trees to a simple sexp representation.
// This representation should be different from the input grammar
// in as many cases as possible, to make it more difficult for incorrect
« no previous file with comments | « src/ast.h ('k') | src/jsregexp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698