1 --- icu/source/test/intltest/regextst.cpp.orig 2009-05-04 17:04:42.413388186 +0800 |
|
2 +++ icu/source/test/intltest/regextst.cpp 2009-05-04 17:03:41.208825004 +0800 |
|
3 @@ -69,6 +69,9 @@ |
|
4 case 7: name = "Callbacks"; |
|
5 if (exec) Callbacks(); |
|
6 break; |
|
7 + case 8: name = "Bug 6149"; |
|
8 + if (exec) Bug6149(); |
|
9 + break; |
|
10 |
|
11 default: name = ""; |
|
12 break; //needed to end loop |
|
13 @@ -1889,6 +1892,12 @@ |
|
14 // Ticket 5389 |
|
15 REGEX_ERR("*c", 1, 1, U_REGEX_RULE_SYNTAX); |
|
16 |
|
17 + // Invalid Back Reference \0 |
|
18 + // For ICU 3.8 and earlier |
|
19 + // For ICU versions newer than 3.8, \0 introduces an octal escape. |
|
20 + // |
|
21 + REGEX_ERR("(ab)\\0", 1, 6, U_REGEX_BAD_ESCAPE_SEQUENCE); |
|
22 + |
|
23 } |
|
24 |
|
25 |
|
26 @@ -2478,5 +2487,27 @@ |
|
27 |
|
28 } |
|
29 |
|
30 +//-------------------------------------------------------------- |
|
31 +// |
|
32 +// Bug6149 Verify limits to heap expansion for backtrack stack. |
|
33 +// Use this pattern, |
|
34 +// "(a?){1,}" |
|
35 +// The zero-length match will repeat forever. |
|
36 +// (That this goes into a loop is another bug) |
|
37 +// |
|
38 +//--------------------------------------------------------------- |
|
39 +void RegexTest::Bug6149() { |
|
40 + UnicodeString pattern("(a?){1,}"); |
|
41 + UnicodeString s("xyz"); |
|
42 + uint32_t flags = 0; |
|
43 + UErrorCode status = U_ZERO_ERROR; |
|
44 + |
|
45 + RegexMatcher matcher(pattern, s, flags, status); |
|
46 + UBool result = false; |
|
47 + REGEX_ASSERT_FAIL(result=matcher.matches(status), U_REGEX_STACK_OVERFLOW); |
|
48 + REGEX_ASSERT(result == FALSE); |
|
49 + } |
|
50 + |
|
51 + |
|
52 #endif /* !UCONFIG_NO_REGULAR_EXPRESSIONS */ |
|
53 |
|