aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2014-12-11 12:28:00 +0000
committerBen Murdoch <benm@google.com>2014-12-11 12:28:00 +0000
commit5b8ca1f9c1c389d3ce2b91ce646bc74da4a4d9a7 (patch)
treefca50c73c6074beda44d158a0ae4e706284035ff
parent18adc60ba73ea14884ecd20eca6875c4ef379cd6 (diff)
parent1e9d139912bd61d9388ec3e1cf8e605983096872 (diff)
downloadicu-5b8ca1f9c1c389d3ce2b91ce646bc74da4a4d9a7.tar.gz
This commit was generated by merge_to_master.py. Change-Id: If3d4d6be21fe0f12c96ed471bc23ccb5941a683b
-rw-r--r--README.chromium6
-rw-r--r--patches/col.patch29
-rw-r--r--source/i18n/ucol.cpp11
3 files changed, 45 insertions, 1 deletions
diff --git a/README.chromium b/README.chromium
index f6015a4..bbb7f8d 100644
--- a/README.chromium
+++ b/README.chromium
@@ -245,3 +245,9 @@ This directory contains the source code of ICU 52.1 for C/C++
http://bugs.icu-project.org/trac/ticket/11370
http://bugs.icu-project.org/trac/ticket/11371
+13. Apply the patch for collator
+ - patches/col.patch
+ - No upstream bug filed because the upstream code was completely
+ rewritten during the ICU 53 cycle.
+
+
diff --git a/patches/col.patch b/patches/col.patch
new file mode 100644
index 0000000..aa117fe
--- /dev/null
+++ b/patches/col.patch
@@ -0,0 +1,29 @@
+Index: source/i18n/ucol.cpp
+===================================================================
+--- source/i18n/ucol.cpp (revision 292709)
++++ source/i18n/ucol.cpp (working copy)
+@@ -2259,6 +2259,9 @@
+ if (data->pos + 1 == data->endp) {
+ return *(data->pos ++);
+ }
++ if (data->pos >= data->endp) {
++ return (UChar) -1; // return U+FFFF (non-char) to indicate an error
++ }
+ }
+ else {
+ if (innormbuf) {
+@@ -2821,7 +2824,13 @@
+ }
+ }
+ } else if (U16_IS_LEAD(schar)) {
+- miss = U16_GET_SUPPLEMENTARY(schar, getNextNormalizedChar(source));
++ UChar nextChar = getNextNormalizedChar(source);
++ const UChar* prevPos = source->pos;
++ if (U16_IS_TRAIL(nextChar)) {
++ miss = U16_GET_SUPPLEMENTARY(schar, nextChar);
++ } else if (prevPos < source->pos) {
++ goBackOne(source);
++ }
+ }
+
+ uint8_t sCC;
diff --git a/source/i18n/ucol.cpp b/source/i18n/ucol.cpp
index b0d819f..e5ff44e 100644
--- a/source/i18n/ucol.cpp
+++ b/source/i18n/ucol.cpp
@@ -2259,6 +2259,9 @@ inline UChar getNextNormalizedChar(collIterate *data)
if (data->pos + 1 == data->endp) {
return *(data->pos ++);
}
+ if (data->pos >= data->endp) {
+ return (UChar) -1; // return U+FFFF (non-char) to indicate an error
+ }
}
else {
if (innormbuf) {
@@ -2821,7 +2824,13 @@ uint32_t ucol_prv_getSpecialCE(const UCollator *coll, UChar ch, uint32_t CE, col
}
}
} else if (U16_IS_LEAD(schar)) {
- miss = U16_GET_SUPPLEMENTARY(schar, getNextNormalizedChar(source));
+ UChar nextChar = getNextNormalizedChar(source);
+ const UChar* prevPos = source->pos;
+ if (U16_IS_TRAIL(nextChar)) {
+ miss = U16_GET_SUPPLEMENTARY(schar, nextChar);
+ } else if (prevPos < source->pos) {
+ goBackOne(source);
+ }
}
uint8_t sCC;