[HarfBuzz] Infinite loop during decomposition when icu_unicode_funcs is used

Kenichi Ishibashi bashi at chromium.org
Thu Oct 27 23:49:15 PDT 2011


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,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/harfbuzz/attachments/20111028/0202fe70/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Count-codepoints-instead-of-calling-u_strlen.patch
Type: text/x-patch
Size: 766 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/harfbuzz/attachments/20111028/0202fe70/attachment.bin>


More information about the HarfBuzz mailing list