This repository has been archived by the owner on Oct 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 339
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deps: update ChakraCore to chakra-core/ChakraCore@5c0bed5a9a
[1.8>1.9] [MERGE #4637 @dilijev] Fix #4368: In unicode-mode RegExp, explicitly disallow invalid escapes. Merge pull request #4637 from dilijev:re-escape-forbidden Fixes #4368 Reviewed-By: chakrabot <chakrabot@users.noreply.github.com>
- Loading branch information
Showing
4 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
deps/chakrashim/core/test/Regex/unicode_forbidden_escapes.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
//------------------------------------------------------------------------------------------------------- | ||
// Copyright (C) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. | ||
//------------------------------------------------------------------------------------------------------- | ||
|
||
WScript.LoadScriptFile("..\\UnitTestFramework\\UnitTestFramework.js"); | ||
|
||
var tests = [ | ||
{ | ||
name: "Unicode-mode RegExp Forbidden Escapes", | ||
body: function () { | ||
let forbidden = [ | ||
'\\p', | ||
'\\P', | ||
'\\a', | ||
'\\A', | ||
'\\e', | ||
'\\E', | ||
'\\y', | ||
'\\Y', | ||
'\\z', | ||
'\\Z', | ||
]; | ||
|
||
for (re of forbidden) { | ||
assert.throws(function () { new RegExp(re, 'u') }, SyntaxError, 'Invalid regular expression: invalid escape in unicode pattern'); | ||
assert.doesNotThrow(function () { new RegExp(re) }); | ||
} | ||
} | ||
} | ||
]; | ||
|
||
testRunner.runTests(tests, { verbose: WScript.Arguments[0] != "summary" }); |