Tue, 04 Feb 2020 17:57:05 +0800
Merge
1.1 --- a/.hgtags Tue Feb 04 17:38:03 2020 +0800 1.2 +++ b/.hgtags Tue Feb 04 17:57:05 2020 +0800 1.3 @@ -1066,8 +1066,18 @@ 1.4 7979e4a31f24adbcf19c9f8f23ac147be5dd4d12 jdk8u232-b03 1.5 41756665474f7bc4ffc591c23887678eb2490ea6 jdk8u232-b04 1.6 52afbdfa7852542f5aa3021336ed7b7069c42997 jdk8u232-b05 1.7 +8a951fd037e245425bbfe061a426a2250096b1ea jdk8u242-b00 1.8 d9dd9b7ce13f7b6ff0124c47106cadf5499e7554 jdk8u232-b06 1.9 0f61e27241b57c8ed5cd9b4d0324ac0d3b0daf13 jdk8u232-b07 1.10 9fc2e50a5c2f98fce148bbe35e43fc17395e3afc jdk8u232-b08 1.11 +fba077f48da23f914f13b11718464a547215b7f6 jdk8u232-b09 1.12 +fba077f48da23f914f13b11718464a547215b7f6 jdk8u232-ga 1.13 52348a92adcafc0e60fe496540b8e3b4d94e8d72 mips64el-jdk8u232-b10 1.14 4f935995670102f832b9c54ba273cf0d6a560904 mips64el-jdk8u232-b11 1.15 +6c540cfd25937bfddc5825a243a40a6615a9dddd jdk8u242-b01 1.16 +49b31f2616534d74144a4fa8480609e70dc56c06 jdk8u242-b02 1.17 +2c0573615bbb89bd2b522d0b4619ef513d3f51dd jdk8u242-b03 1.18 +6375475624314776773afbd023fabae34054cf52 jdk8u242-b04 1.19 +735e7a309c5b0623bf25b29a0a1e7e437d56a43c jdk8u242-b05 1.20 +0735b1dcec3677634ca632683ca14911431a236a jdk8u242-b06 1.21 +1bccea33f6dbb43bf0cb74b82bd9669aba5319ab jdk8u242-b07
2.1 --- a/THIRD_PARTY_README Tue Feb 04 17:38:03 2020 +0800 2.2 +++ b/THIRD_PARTY_README Tue Feb 04 17:57:05 2020 +0800 2.3 @@ -1334,11 +1334,13 @@ 2.4 2.5 -------------------------------------------------------------------------------- 2.6 2.7 -%% This notice is provided with respect to Joni v1.1.9, which may be 2.8 +%% This notice is provided with respect to Joni v2.1.16, which may be 2.9 included with JRE 8, JDK 8, and OpenJDK 8. 2.10 2.11 --- begin of LICENSE --- 2.12 2.13 +Copyright (c) 2017 JRuby Team 2.14 + 2.15 Permission is hereby granted, free of charge, to any person obtaining a copy 2.16 of this software and associated documentation files (the "Software"), to deal 2.17 in the Software without restriction, including without limitation the rights
3.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ByteCodeMachine.java Tue Feb 04 17:38:03 2020 +0800 3.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ByteCodeMachine.java Tue Feb 04 17:57:05 2020 +0800 3.3 @@ -541,7 +541,6 @@ 3.4 sprev = s; 3.5 s++; 3.6 } 3.7 - sprev = sbegin; // break; 3.8 } 3.9 3.10 private void opAnyCharMLStar() { 3.11 @@ -550,7 +549,6 @@ 3.12 sprev = s; 3.13 s++; 3.14 } 3.15 - sprev = sbegin; // break; 3.16 } 3.17 3.18 private void opAnyCharStarPeekNext() {
4.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/Config.java Tue Feb 04 17:38:03 2020 +0800 4.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/Config.java Tue Feb 04 17:57:05 2020 +0800 4.3 @@ -45,6 +45,7 @@ 4.4 4.5 final int NREGION = 10; 4.6 final int MAX_BACKREF_NUM = 1000; 4.7 + final int MAX_CAPTURE_GROUP_NUM = 0x8000; 4.8 final int MAX_REPEAT_NUM = 100000; 4.9 final int MAX_MULTI_BYTE_RANGES_NUM = 10000; 4.10
5.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ScanEnvironment.java Tue Feb 04 17:38:03 2020 +0800 5.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ScanEnvironment.java Tue Feb 04 17:57:05 2020 +0800 5.3 @@ -62,6 +62,9 @@ 5.4 } 5.5 5.6 public int addMemEntry() { 5.7 + if (numMem >= Config.MAX_CAPTURE_GROUP_NUM) { 5.8 + throw new InternalException(ErrorMessages.ERR_TOO_MANY_CAPTURE_GROUPS); 5.9 + } 5.10 if (numMem++ == 0) { 5.11 memNodes = new Node[SCANENV_MEMNODES_SIZE]; 5.12 } else if (numMem >= memNodes.length) {
6.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/exception/ErrorMessages.java Tue Feb 04 17:38:03 2020 +0800 6.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/exception/ErrorMessages.java Tue Feb 04 17:57:05 2020 +0800 6.3 @@ -31,6 +31,7 @@ 6.4 final String ERR_PARSER_BUG = "internal parser error (bug)"; 6.5 final String ERR_UNDEFINED_BYTECODE = "undefined bytecode (bug)"; 6.6 final String ERR_UNEXPECTED_BYTECODE = "unexpected bytecode (bug)"; 6.7 + final String ERR_TOO_MANY_CAPTURE_GROUPS = "too many capture groups"; 6.8 6.9 /* syntax error */ 6.10 final String ERR_END_PATTERN_AT_LEFT_BRACE = "end pattern at left brace";
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/test/script/basic/JDK-8204288.js Tue Feb 04 17:57:05 2020 +0800 7.3 @@ -0,0 +1,35 @@ 7.4 +/* 7.5 + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. 7.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7.7 + * 7.8 + * This code is free software; you can redistribute it and/or modify it 7.9 + * under the terms of the GNU General Public License version 2 only, as 7.10 + * published by the Free Software Foundation. 7.11 + * 7.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 7.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 7.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 7.15 + * version 2 for more details (a copy is included in the LICENSE file that 7.16 + * accompanied this code). 7.17 + * 7.18 + * You should have received a copy of the GNU General Public License version 7.19 + * 2 along with this work; if not, write to the Free Software Foundation, 7.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 7.21 + * 7.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 7.23 + * or visit www.oracle.com if you need additional information or have any 7.24 + * questions. 7.25 + */ 7.26 + 7.27 +/** 7.28 + * JDK-8204288: Matching the end of a string followed by an empty greedy regex and a word boundary fails 7.29 + * 7.30 + * @test 7.31 + * @run 7.32 + */ 7.33 + 7.34 + 7.35 +Assert.assertEquals(new RegExp("c.*\\b").exec("abc")[0], "c"); 7.36 +Assert.assertEquals(new RegExp("abc.*\\b").exec("abc")[0], "abc"); 7.37 +Assert.assertEquals(new RegExp("\\b.*abc.*\\b").exec("abc")[0], "abc"); 7.38 +
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 8.2 +++ b/test/script/basic/JDK-8204290.js Tue Feb 04 17:57:05 2020 +0800 8.3 @@ -0,0 +1,40 @@ 8.4 +/* 8.5 + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. 8.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 8.7 + * 8.8 + * This code is free software; you can redistribute it and/or modify it 8.9 + * under the terms of the GNU General Public License version 2 only, as 8.10 + * published by the Free Software Foundation. 8.11 + * 8.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 8.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 8.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 8.15 + * version 2 for more details (a copy is included in the LICENSE file that 8.16 + * accompanied this code). 8.17 + * 8.18 + * You should have received a copy of the GNU General Public License version 8.19 + * 2 along with this work; if not, write to the Free Software Foundation, 8.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 8.21 + * 8.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 8.23 + * or visit www.oracle.com if you need additional information or have any 8.24 + * questions. 8.25 + */ 8.26 + 8.27 +/** 8.28 + * JDK-8204290: Add check to limit number of capture groups 8.29 + * 8.30 + * @test 8.31 + * @run 8.32 + */ 8.33 + 8.34 +try { 8.35 + var captureGroups = ""; 8.36 + for (i=0; i < 0x8001; i++) { captureGroups += "()"; } 8.37 + new RegExp(captureGroups); 8.38 + fail("Expected exception"); 8.39 +} catch (e) { 8.40 + Assert.assertTrue(e instanceof SyntaxError); 8.41 + Assert.assertEquals(e.message, "too many capture groups"); 8.42 +} 8.43 +