[HarfBuzz] Infinite loop during decomposition when icu_unicode_funcs is used

Behdad Esfahbod behdad at behdad.org
Fri Oct 28 07:37:30 PDT 2011


Ah, interesting.  I should be more careful, reading API docs actually.  Thanks
for the patch, will push out with the next batch.

behdad

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