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

Unified Diff: src/ast/ast.h

Issue 1522353002: [regexp] break recursion in mutually recursive capture/back references. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: new test expectations Created 5 years 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/parsing/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/ast.h
diff --git a/src/ast/ast.h b/src/ast/ast.h
index b4f2992e047215ac95d2c61b96a98d64afbfb5a1..6a0393cb6cd76b7f12dca3840915ae727dafd8e5 100644
--- a/src/ast/ast.h
+++ b/src/ast/ast.h
@@ -3186,14 +3186,9 @@ class RegExpBackReference final : public RegExpTree {
RegExpBackReference* AsBackReference() override;
bool IsBackReference() override;
int min_match() override { return 0; }
- // The capture may not be completely parsed yet, if the reference occurs
- // before the capture. In the ordinary case, nothing has been captured yet,
- // so the back reference must have the length 0. If the back reference is
- // inside a lookbehind, effectively making it a forward reference, we return
- // 0 since lookbehinds have a length of 0.
- int max_match() override {
- return capture_->body() ? capture_->max_match() : 0;
- }
+ // The back reference may be recursive, e.g. /(\2)(\1)/. To avoid infinite
+ // recursion, we give up. Ignorance is bliss.
+ int max_match() override { return kInfinity; }
int index() { return capture_->index(); }
RegExpCapture* capture() { return capture_; }
private:
« no previous file with comments | « no previous file | src/parsing/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698