Chromium Code Reviews| Index: src/regexp/regexp-parser.cc |
| diff --git a/src/regexp/regexp-parser.cc b/src/regexp/regexp-parser.cc |
| index 3035f6a9a953e6eb5ffe4466e07612f27b6c9996..cbfa80dcf0e0e46374714c8dfd5fc7c70da94a99 100644 |
| --- a/src/regexp/regexp-parser.cc |
| +++ b/src/regexp/regexp-parser.cc |
| @@ -768,6 +768,26 @@ bool RegExpParser::CreateNamedCaptureAtIndex(const ZoneVector<uc16>* name, |
| DCHECK(0 < index && index <= captures_started_); |
| DCHECK_NOT_NULL(name); |
| + static std::vector<uc16> illegal_names[] = { |
|
jgruber
2017/01/17 09:26:51
The final proposal might not need this blacklist i
|
| + { |
| + 'i', 'n', 'd', 'e', 'x', |
| + }, |
| + { |
| + 'i', 'n', 'p', 'u', 't', |
| + }, |
| + { |
| + 'l', 'e', 'n', 'g', 't', 'h', |
| + }, |
| + }; |
| + |
| + for (const auto& illegal_name : illegal_names) { |
| + if (name->size() != illegal_name.size()) continue; |
| + if (std::equal(name->begin(), name->end(), illegal_name.begin())) { |
| + ReportError(CStrVector("Illegal capture group name")); |
| + return false; |
| + } |
| + } |
| + |
| if (named_captures_ == nullptr) { |
| named_captures_ = new (zone()) ZoneList<RegExpCapture*>(1, zone()); |
| } else { |