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

Unified Diff: src/jsregexp.h

Issue 10380028: Limit recursion depth for gathering BoyerMoore info. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 7 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 | src/jsregexp.cc » ('j') | test/mjsunit/regress/regress-126412.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/jsregexp.h
diff --git a/src/jsregexp.h b/src/jsregexp.h
index 20313ca559ff1dff6a47c4dd86879a64b6451dc5..3f7bbdf4546cba286c9daf20dd7394028b3899e2 100644
--- a/src/jsregexp.h
+++ b/src/jsregexp.h
@@ -185,7 +185,7 @@ class RegExpImpl {
// total regexp code compiled including code that has subsequently been freed
// and the total executable memory at any point.
static const int kRegExpExecutableMemoryLimit = 16 * MB;
- static const int kRegWxpCompiledLimit = 1 * MB;
+ static const int kRegExpCompiledLimit = 1 * MB;
private:
static String* last_ascii_string_;
@@ -1236,6 +1236,12 @@ class BoyerMooreLookahead : public ZoneObject {
}
bool EmitSkipInstructions(RegExpMacroAssembler* masm);
+ bool MaxDepthExceeded() {
+ return (++depth_ > kMaxFillInDepth);
+ }
+
+ static const int kMaxFillInDepth = 1024;
+
private:
// This is the value obtained by EatsAtLeast. If we do not have at least this
// many characters left in the sample string then the match is bound to fail.
@@ -1243,6 +1249,7 @@ class BoyerMooreLookahead : public ZoneObject {
// point.
int length_;
RegExpCompiler* compiler_;
+ int depth_;
// 0x7f for ASCII, 0xffff for UTF-16.
int max_char_;
ZoneList<BoyerMoorePositionInfo*>* bitmaps_;
« no previous file with comments | « no previous file | src/jsregexp.cc » ('j') | test/mjsunit/regress/regress-126412.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698