summaryrefslogtreecommitdiff
path: root/extra/icu/fix_broken_regex.diff
diff options
context:
space:
mode:
authorNicolás Reynolds <fauno@kiwwwi.com.ar>2012-05-23 12:45:39 -0300
committerNicolás Reynolds <fauno@kiwwwi.com.ar>2012-05-23 12:45:39 -0300
commit7516400a778a0a4a0668d0a2ea797a635d6d4dd2 (patch)
tree5ab321abf9f41be345f44409235b62ccb31e0d49 /extra/icu/fix_broken_regex.diff
parent1de77ff2ad96a2adfd9eb797bb2ca1bb15c2a707 (diff)
parent39c366b9fc1b83a741177d0b415a20147a18a3c0 (diff)
Merge branch 'master' of ssh://gparabola/srv/git/abslibre-mips64el
Diffstat (limited to 'extra/icu/fix_broken_regex.diff')
-rw-r--r--extra/icu/fix_broken_regex.diff35
1 files changed, 35 insertions, 0 deletions
diff --git a/extra/icu/fix_broken_regex.diff b/extra/icu/fix_broken_regex.diff
new file mode 100644
index 000000000..8161a1107
--- /dev/null
+++ b/extra/icu/fix_broken_regex.diff
@@ -0,0 +1,35 @@
+--- i18n/regexcmp.cpp
++++ i18n/regexcmp.cpp
+@@ -3307,8 +3307,29 @@
+
+ case URX_STRING_I:
+- // TODO: Is the case-folded string the longest?
+- // If so we can optimize this the same as URX_STRING.
+- loc++;
+- currentLen = INT32_MAX;
++ // TODO: This code assumes that any user string that matches will be no longer
++ // than our compiled string, with case insensitive matching.
++ // Our compiled string has been case-folded already.
++ //
++ // Any matching user string will have no more code points than our
++ // compiled (folded) string. Folding may add code points, but
++ // not remove them.
++ //
++ // There is a potential problem if a supplemental code point
++ // case-folds to a BMP code point. In this case our compiled string
++ // could be shorter (in code units) than a matching user string.
++ //
++ // At this time (Unicode 6.1) there are no such characters, and this case
++ // is not being handled. A test, intltest regex/Bug9283, will fail if
++ // any problematic characters are added to Unicode.
++ //
++ // If this happens, we can make a set of the BMP chars that the
++ // troublesome supplementals fold to, scan our string, and bump the
++ // currentLen one extra for each that is found.
++ //
++ {
++ loc++;
++ int32_t stringLenOp = (int32_t)fRXPat->fCompiledPat->elementAti(loc);
++ currentLen = safeIncrement(currentLen, URX_VAL(stringLenOp));
++ }
+ break;