From: Michael Ow Date: Wed, 1 Feb 2012 23:45:54 +0000 (+0000) Subject: ICU-9085 Fix infinite loop error in compound text converter in ICU4C X-Git-Tag: milestone-59-0-1~4100 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4fc83fb80ce23fe0a2f500b03c2bc6ed4247bb80;p=icu ICU-9085 Fix infinite loop error in compound text converter in ICU4C X-SVN-Rev: 31298 --- diff --git a/icu4c/source/common/ucnv_ct.c b/icu4c/source/common/ucnv_ct.c index 393bd3f515f..d51831de22b 100644 --- a/icu4c/source/common/ucnv_ct.c +++ b/icu4c/source/common/ucnv_ct.c @@ -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; } diff --git a/icu4c/source/test/testdata/conversion.txt b/icu4c/source/test/testdata/conversion.txt index 989a336e54a..99bd32b4954 100644 --- a/icu4c/source/test/testdata/conversion.txt +++ b/icu4c/source/test/testdata/conversion.txt @@ -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{""} + } } }