From af63871593d1540c3d66318426b739953c674c3a Mon Sep 17 00:00:00 2001 From: Franziska Hinkelmann Date: Fri, 22 Jul 2016 10:48:00 +0200 Subject: [PATCH] deps: cherry-pick a51f429 from V8 upstream MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. R=marja@chromium.org BUG=v8:5199 Review-Url: https://codereview.chromium.org/2159683002 Cr-Commit-Position: refs/heads/master@{#37833} Fixes: https://github.com/nodejs/node/issues/7708 PR-URL: https://github.com/nodejs/node/pull/7834 Ref: https://github.com/nodejs/node/pull/7833 Reviewed-By: targos - Michaƫl Zasso Reviewed-By: bnoordhuis - Ben Noordhuis Reviewed-By: jasnell - James M Snell Reviewed-By: ofrobots - Ali Ijaz Sheikh --- deps/v8/include/v8-version.h | 2 +- deps/v8/src/regexp/jsregexp.cc | 1 + deps/v8/test/mjsunit/regress/regress-5199.js | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 deps/v8/test/mjsunit/regress/regress-5199.js diff --git a/deps/v8/include/v8-version.h b/deps/v8/include/v8-version.h index 4d5266ba421bc6..a73d31b083c5bf 100644 --- a/deps/v8/include/v8-version.h +++ b/deps/v8/include/v8-version.h @@ -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.) diff --git a/deps/v8/src/regexp/jsregexp.cc b/deps/v8/src/regexp/jsregexp.cc index 80f48ca1a9fd34..4255e7e6736ec0 100644 --- a/deps/v8/src/regexp/jsregexp.cc +++ b/deps/v8/src/regexp/jsregexp.cc @@ -5877,6 +5877,7 @@ Vector CharacterRange::GetWordBounds() { void CharacterRange::AddCaseEquivalents(Isolate* isolate, Zone* zone, ZoneList* 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); diff --git a/deps/v8/test/mjsunit/regress/regress-5199.js b/deps/v8/test/mjsunit/regress/regress-5199.js new file mode 100644 index 00000000000000..818e71a06d30f8 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-5199.js @@ -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'));