Merge jdk8u242-b04

Wed, 04 Dec 2019 16:23:50 +0000

author
andrew
date
Wed, 04 Dec 2019 16:23:50 +0000
changeset 2524
637547562431
parent 2521
61edd0c12ca0
parent 2523
319c1b31d551
child 2525
191f7b51899b

Merge

     1.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ByteCodeMachine.java	Wed Nov 27 05:33:23 2019 +0000
     1.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ByteCodeMachine.java	Wed Dec 04 16:23:50 2019 +0000
     1.3 @@ -541,7 +541,6 @@
     1.4              sprev = s;
     1.5              s++;
     1.6          }
     1.7 -        sprev = sbegin; // break;
     1.8      }
     1.9  
    1.10      private void opAnyCharMLStar() {
    1.11 @@ -550,7 +549,6 @@
    1.12              sprev = s;
    1.13              s++;
    1.14          }
    1.15 -        sprev = sbegin; // break;
    1.16      }
    1.17  
    1.18      private void opAnyCharStarPeekNext() {
     2.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/Config.java	Wed Nov 27 05:33:23 2019 +0000
     2.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/Config.java	Wed Dec 04 16:23:50 2019 +0000
     2.3 @@ -45,6 +45,7 @@
     2.4  
     2.5      final int NREGION                   = 10;
     2.6      final int MAX_BACKREF_NUM           = 1000;
     2.7 +    final int MAX_CAPTURE_GROUP_NUM     = 0x8000;
     2.8      final int MAX_REPEAT_NUM            = 100000;
     2.9      final int MAX_MULTI_BYTE_RANGES_NUM = 10000;
    2.10  
     3.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ScanEnvironment.java	Wed Nov 27 05:33:23 2019 +0000
     3.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ScanEnvironment.java	Wed Dec 04 16:23:50 2019 +0000
     3.3 @@ -62,6 +62,9 @@
     3.4      }
     3.5  
     3.6      public int addMemEntry() {
     3.7 +        if (numMem >= Config.MAX_CAPTURE_GROUP_NUM) {
     3.8 +            throw new InternalException(ErrorMessages.ERR_TOO_MANY_CAPTURE_GROUPS);
     3.9 +        }
    3.10          if (numMem++ == 0) {
    3.11              memNodes = new Node[SCANENV_MEMNODES_SIZE];
    3.12          } else if (numMem >= memNodes.length) {
     4.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/exception/ErrorMessages.java	Wed Nov 27 05:33:23 2019 +0000
     4.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/exception/ErrorMessages.java	Wed Dec 04 16:23:50 2019 +0000
     4.3 @@ -31,6 +31,7 @@
     4.4      final String ERR_PARSER_BUG = "internal parser error (bug)";
     4.5      final String ERR_UNDEFINED_BYTECODE = "undefined bytecode (bug)";
     4.6      final String ERR_UNEXPECTED_BYTECODE = "unexpected bytecode (bug)";
     4.7 +    final String ERR_TOO_MANY_CAPTURE_GROUPS = "too many capture groups";
     4.8  
     4.9      /* syntax error */
    4.10      final String ERR_END_PATTERN_AT_LEFT_BRACE = "end pattern at left brace";
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/test/script/basic/JDK-8204288.js	Wed Dec 04 16:23:50 2019 +0000
     5.3 @@ -0,0 +1,35 @@
     5.4 +/*
     5.5 + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
     5.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5.7 + * 
     5.8 + * This code is free software; you can redistribute it and/or modify it
     5.9 + * under the terms of the GNU General Public License version 2 only, as
    5.10 + * published by the Free Software Foundation.
    5.11 + * 
    5.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    5.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    5.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    5.15 + * version 2 for more details (a copy is included in the LICENSE file that
    5.16 + * accompanied this code).
    5.17 + * 
    5.18 + * You should have received a copy of the GNU General Public License version
    5.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    5.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    5.21 + * 
    5.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    5.23 + * or visit www.oracle.com if you need additional information or have any
    5.24 + * questions.
    5.25 + */
    5.26 +
    5.27 +/**
    5.28 + * JDK-8204288: Matching the end of a string followed by an empty greedy regex and a word boundary fails
    5.29 + *
    5.30 + * @test
    5.31 + * @run
    5.32 + */
    5.33 +
    5.34 +
    5.35 +Assert.assertEquals(new RegExp("c.*\\b").exec("abc")[0], "c");
    5.36 +Assert.assertEquals(new RegExp("abc.*\\b").exec("abc")[0], "abc");
    5.37 +Assert.assertEquals(new RegExp("\\b.*abc.*\\b").exec("abc")[0], "abc");
    5.38 +
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/test/script/basic/JDK-8204290.js	Wed Dec 04 16:23:50 2019 +0000
     6.3 @@ -0,0 +1,40 @@
     6.4 +/*
     6.5 + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
     6.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     6.7 + * 
     6.8 + * This code is free software; you can redistribute it and/or modify it
     6.9 + * under the terms of the GNU General Public License version 2 only, as
    6.10 + * published by the Free Software Foundation.
    6.11 + * 
    6.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    6.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    6.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    6.15 + * version 2 for more details (a copy is included in the LICENSE file that
    6.16 + * accompanied this code).
    6.17 + * 
    6.18 + * You should have received a copy of the GNU General Public License version
    6.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    6.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    6.21 + * 
    6.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    6.23 + * or visit www.oracle.com if you need additional information or have any
    6.24 + * questions.
    6.25 + */
    6.26 +
    6.27 +/**
    6.28 + * JDK-8204290: Add check to limit number of capture groups
    6.29 + *
    6.30 + * @test
    6.31 + * @run
    6.32 + */
    6.33 +
    6.34 +try {
    6.35 +    var captureGroups = "";
    6.36 +    for (i=0; i < 0x8001; i++) { captureGroups += "()"; }
    6.37 +    new RegExp(captureGroups);
    6.38 +    fail("Expected exception");
    6.39 +} catch (e) {
    6.40 +    Assert.assertTrue(e instanceof SyntaxError);
    6.41 +    Assert.assertEquals(e.message, "too many capture groups");
    6.42 +}
    6.43 +

mercurial