提交 9c97b0da 编写于 作者: I igerasim

8169056: StringIndexOutOfBoundsException in Pattern.compile with CANON_EQ flag

Reviewed-by: coffeys
上级 fdcc7ca3
/*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -1411,6 +1411,8 @@ public final class Pattern
String result;
i++;
if (i == normalizedPattern.length())
throw error("Unclosed character class");
charClass.append("[");
while(true) {
int c = normalizedPattern.codePointAt(i);
......
/*
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -32,7 +32,7 @@
* 6358731 6178785 6284152 6231989 6497148 6486934 6233084 6504326 6635133
* 6350801 6676425 6878475 6919132 6931676 6948903 6990617 7014645 7039066
* 7067045 7014640 7189363 8007395 8013252 8013254 8012646 8023647 6559590
* 8027645 6854417
* 8027645 6854417 8169056
*/
import java.util.regex.*;
......@@ -2144,6 +2144,14 @@ public class RegExTest {
if (!pattern.matcher("\u017f\u0130\u0131\u212a\u212b").matches())
failCount++;
try {
Pattern.compile("[", Pattern.CANON_EQ);
failCount++;
} catch (PatternSyntaxException expected) {
} catch (Exception unexpected) {
failCount++;
}
report("CharClass");
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册