[HarfBuzz] Infinite loop during decomposition when icu_unicode_funcs is used
Behdad Esfahbod
behdad at behdad.org
Wed Jan 18 19:17:28 PST 2012
Ok, I found u_countChar32() and used it in both places that I had u_strlen().
On 10/28/2011 02:49 AM, Kenichi Ishibashi wrote:
> Hi,
>
> hb_icu_unicode_decompose() uses ICU's u_strlen() to get the number of Unicode
> codepoints in normalized buffer. However, it seems that it returns the number
> of UChars in the buffer. UChar is equivalent to uint16_t. This means that we
> can't get right number of codepoints when the buffer contains surrogate pairs.
> This eventually causes infinite loop during decomposition. For example, if the
> function is called like:
>
> hb_codepoint_t a, b;
> hb_icu_unicode_decompose(0/*unused*/, 0x1f1ef /* REGIONAL INDICATOR SYMBOL
> LETTER J */, &a, &b, 0/*unused*/);
>
> then, it returns TRUE with *a == 0x1f1ef. This leads infinite loop in
> decompose(). Attached patch would fix the problem.
>
> Thanks,
>
>
>
> _______________________________________________
> HarfBuzz mailing list
> HarfBuzz at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/harfbuzz
More information about the HarfBuzz
mailing list