1 Index: icu/source/i18n/regexcmp.cpp
2 ===================================================================
3 --- icu/source/i18n/regexcmp.cpp (revision 36726)
4 +++ icu/source/i18n/regexcmp.cpp (revision 36727)
6 if (fIntervalUpper == 0) {
7 // Pathological case. Attempt no matches, as if the block doesn't exist.
8 + // Discard the generated code for the block.
9 + // If the block included parens, discard the info pertaining to them as well.
10 fRXPat->fCompiledPat->setSize(topOfBlock);
11 + if (fMatchOpenParen >= topOfBlock) {
12 + fMatchOpenParen = -1;
14 + if (fMatchCloseParen >= topOfBlock) {
15 + fMatchCloseParen = -1;
19 Index: icu/source/i18n/regexcmp.h
20 ===================================================================
21 --- icu/source/i18n/regexcmp.h (revision 36726)
22 +++ icu/source/i18n/regexcmp.h (revision 36727)
24 // of the slot reserved for a state save
25 // at the start of the most recently processed
26 - // parenthesized block.
27 + // parenthesized block. Updated when processing
28 + // a close to the location for the corresponding open.
30 int32_t fMatchCloseParen; // The position in the pattern of the first
31 // location after the most recently processed
32 Index: icu/source/test/testdata/regextst.txt
33 ===================================================================
34 --- icu/source/test/testdata/regextst.txt (revision 36726)
35 +++ icu/source/test/testdata/regextst.txt (revision 36727)
36 @@ -1202,4 +1202,13 @@
37 "A|B|\U00010000" "hello \ud800"
40 +# Incorrect optimization of patterns with a zero length quantifier {0}
42 +"(.|b)(|b){0}\$(?#xxx){3}(?>\D*)" "AAAAABBBBBCCCCCDDDDEEEEE"
43 +"(|b)ab(c)" "<0><1></1>ab<2>c</2></0>"
44 +"(|b){0}a{3}(D*)" "<0>aaa<2></2></0>"
45 +"(|b){0,1}a{3}(D*)" "<0><1></1>aaa<2></2></0>"
46 +"((|b){0})a{3}(D*)" "<0><1></1>aaa<3></3></0>"
49 # Max match length computation of look-behind expression gives result that is too big to fit in the
51 "(?<!(0123456789a){10000000})x" E "no match"
52 "(?<!\\ubeaf(\\ubeaf{11000}){11000})" E "no match"
55 # Random debugging, Temporary