Skip to content

Commit

Permalink
deps: cherry-pick a51f429 from V8 upstream
Browse files Browse the repository at this point in the history
Original commit message:
  [regexp] Fix case-insensitive matching for one-byte subjects.

  The bug occurs because we do not canonicalize character class ranges
  before adding case equivalents. While adding case equivalents, we abort
  early for one-byte subject strings, assuming that the ranges are sorted.
  Which they are not.

  [email protected]
  BUG=v8:5199

  Review-Url: https://codereview.chromium.org/2159683002
  Cr-Commit-Position: refs/heads/master@{#37833}

Fixes: #7708
PR-URL: #7834
Ref: #7833
Reviewed-By: targos - Michaël Zasso <[email protected]>
Reviewed-By: bnoordhuis - Ben Noordhuis <[email protected]>
Reviewed-By: jasnell - James M Snell <[email protected]>
Reviewed-By: ofrobots - Ali Ijaz Sheikh <[email protected]>
  • Loading branch information
fhinkel authored and ofrobots committed Aug 3, 2016
1 parent 980f4da commit af63871
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion deps/v8/include/v8-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define V8_MAJOR_VERSION 5
#define V8_MINOR_VERSION 0
#define V8_BUILD_NUMBER 71
#define V8_PATCH_LEVEL 58
#define V8_PATCH_LEVEL 59

// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
Expand Down
1 change: 1 addition & 0 deletions deps/v8/src/regexp/jsregexp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5877,6 +5877,7 @@ Vector<const int> CharacterRange::GetWordBounds() {
void CharacterRange::AddCaseEquivalents(Isolate* isolate, Zone* zone,
ZoneList<CharacterRange>* ranges,
bool is_one_byte) {
CharacterRange::Canonicalize(ranges);
int range_count = ranges->length();
for (int i = 0; i < range_count; i++) {
CharacterRange range = ranges->at(i);
Expand Down
5 changes: 5 additions & 0 deletions deps/v8/test/mjsunit/regress/regress-5199.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Copyright 2016 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(/(a[\u1000A])+/i.test('aa'));

0 comments on commit af63871

Please sign in to comment.