]> granicus.if.org Git - icu/commitdiff
ICU-9085 Fix infinite loop error in compound text converter in ICU4C
authorMichael Ow <mow@svn.icu-project.org>
Wed, 1 Feb 2012 23:45:54 +0000 (23:45 +0000)
committerMichael Ow <mow@svn.icu-project.org>
Wed, 1 Feb 2012 23:45:54 +0000 (23:45 +0000)
X-SVN-Rev: 31298

icu4c/source/common/ucnv_ct.c
icu4c/source/test/testdata/conversion.txt

index 393bd3f515f31f1723bfd4942ef0fa4ed5e25783..d51831de22b3416554bba53ca302bf1478a6e746 100644 (file)
@@ -1,6 +1,6 @@
 /*
 **********************************************************************
-*   Copyright (C) 2010-2011, International Business Machines
+*   Copyright (C) 2010-2012, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 **********************************************************************
 *   file name:  ucnv_ct.c
@@ -504,6 +504,9 @@ UConverter_toUnicode_CompoundText_OFFSETS(UConverterToUnicodeArgs *args,
                     *err = U_ZERO_ERROR;
                     break;
                 } else if (tmpState == INVALID) {
+                    if (args->converter->toULength == 0) {
+                        mySource++; /* skip over the 0x1b byte */
+                    }
                     *err = U_ILLEGAL_CHAR_FOUND;
                     break;
                 }
index 989a336e54a1034703b51b0aa8939c86ba339c5e..99bd32b49547a2dc651889c6e71c530168832c1c 100644 (file)
@@ -1,6 +1,6 @@
 //*******************************************************************************
 //
-//   Copyright (C) 2003-2011, International Business Machines
+//   Copyright (C) 2003-2012, International Business Machines
 //   Corporation and others.  All Rights Reserved.
 //
 //   file name:  conversion.txt
@@ -980,6 +980,13 @@ conversion:table(nofallback) {
           :intvector{ 1,5,7,9 },
           :int{0}, :int{0}, "", ".", :bin{""}
         }
+        {
+          "x11-compound-text",
+          :bin{ 1e6ddc9b26bc10801bbcad50a040fc },
+          "\u001e\u006d\u00dc\u009b\u0026\u00bc\u0010\u0080\ufffd\u00bc\u00ad\u0050\u00a0\u0040\u00fc",
+          :intvector{ },
+          :int{1}, :int{0}, "", "?", :bin{""}
+        }
       }
     }