ICU-20544 Regex, fix min/max match length computation with negative look-behind patterns.

This commit is contained in:
Andy Heninger 2019-04-09 13:45:46 -07:00
parent 6daab85db4
commit 7053363323
2 changed files with 6 additions and 3 deletions

View file

@ -2328,7 +2328,7 @@ void RegexCompile::handleCloseParen() {
error(U_REGEX_LOOK_BEHIND_LIMIT);
break;
}
if (minML == INT32_MAX && maxML == 0) {
if (minML == INT32_MAX) {
// This condition happens when no match is possible, such as with a
// [set] expression containing no elements.
// In principle, the generated code to evaluate the expression could be deleted,

View file

@ -1439,13 +1439,16 @@
"[^\u0000-\U0010ffff]" "a"
"[^[^\u0000-\U0010ffff]]" "<0>a</0>"
# Bug ICU-20544. Similar to 20385, above. Assertion failure with a negative look-behind assertion containing
# a set with no contents. Look-behind pattern includes more than just the empty set.
"(?<![ⰿ&&m]c)" "<0></0>abc" # note: first 'ⰿ' is \u2c3f, hence empty set.
"(?<![^\u0000-\U0010ffff]c)" "<0></0>abc"
# Random debugging, Temporary
#
#
# Regexps from http://www.regexlib.com
#