[regexp] Fix a bug causing early aborts from AddCaseEquivalents
A while ago, CharacterRange::AddCaseEquivalents used to operate on a
single range (the `this` value) and add case equivalents for that to
`ranges`.
This was changed in a2baaaac
to use `ranges` as a list of incoming
operands instead. When we now determine that the current range does not
have case equivalents, we need to `continue` instead of `return` to
avoid skipping the remaining ranges in the list.
Bug: v8:6940
Change-Id: I9face88a2ef8b9408f177e503f3399a25e688e06
Reviewed-on: https://chromium-review.googlesource.com/725430
Reviewed-by: Yang Guo <yangguo@chromium.org>
Reviewed-by: Marja Hölttä <marja@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48682}
This commit is contained in:
parent
c7d1c7b798
commit
8016f309e7
@ -5894,7 +5894,7 @@ Vector<const int> CharacterRange::GetWordBounds() {
|
||||
return Vector<const int>(kWordRanges, kWordRangeCount - 1);
|
||||
}
|
||||
|
||||
|
||||
// static
|
||||
void CharacterRange::AddCaseEquivalents(Isolate* isolate, Zone* zone,
|
||||
ZoneList<CharacterRange>* ranges,
|
||||
bool is_one_byte) {
|
||||
@ -5903,12 +5903,12 @@ void CharacterRange::AddCaseEquivalents(Isolate* isolate, Zone* zone,
|
||||
for (int i = 0; i < range_count; i++) {
|
||||
CharacterRange range = ranges->at(i);
|
||||
uc32 bottom = range.from();
|
||||
if (bottom > String::kMaxUtf16CodeUnit) return;
|
||||
if (bottom > String::kMaxUtf16CodeUnit) continue;
|
||||
uc32 top = Min(range.to(), String::kMaxUtf16CodeUnit);
|
||||
// Nothing to be done for surrogates.
|
||||
if (bottom >= kLeadSurrogateStart && top <= kTrailSurrogateEnd) return;
|
||||
if (bottom >= kLeadSurrogateStart && top <= kTrailSurrogateEnd) continue;
|
||||
if (is_one_byte && !RangeContainsLatin1Equivalents(range)) {
|
||||
if (bottom > String::kMaxOneByteCharCode) return;
|
||||
if (bottom > String::kMaxOneByteCharCode) continue;
|
||||
if (top > String::kMaxOneByteCharCode) top = String::kMaxOneByteCharCode;
|
||||
}
|
||||
unibrow::uchar chars[unibrow::Ecma262UnCanonicalize::kMaxWidth];
|
||||
|
9
test/mjsunit/regress/regress-v8-6940.js
Normal file
9
test/mjsunit/regress/regress-v8-6940.js
Normal file
@ -0,0 +1,9 @@
|
||||
// Copyright 2017 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
assertTrue(/[ŸŶ]/i.test('ÿ'));
|
||||
assertTrue(/[ŸY]/i.test('ÿ'));
|
||||
|
||||
assertTrue(/[YÝŸŶỲ]/i.test('ÿ'));
|
||||
assertTrue(/[YÝŸŶỲ]/iu.test('ÿ'));
|
Loading…
Reference in New Issue
Block a user