ICU-20544 Regex, fix min/max match length computation with negative look-behind patterns.
diff --git a/icu4c/source/i18n/regexcmp.cpp b/icu4c/source/i18n/regexcmp.cpp
index 2d14aa8..dcd754d 100644
--- a/icu4c/source/i18n/regexcmp.cpp
+++ b/icu4c/source/i18n/regexcmp.cpp
@@ -2328,7 +2328,7 @@
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,
diff --git a/icu4c/source/test/testdata/regextst.txt b/icu4c/source/test/testdata/regextst.txt
index ba84af0..552f067 100644
--- a/icu4c/source/test/testdata/regextst.txt
+++ b/icu4c/source/test/testdata/regextst.txt
@@ -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
#