RFR: 8246348: Crash in libpango on Ubuntu 20.04 with some unicode chars

Kevin Rushforth kcr at openjdk.java.net
Thu Jun 11 19:22:21 UTC 2020

On Thu, 11 Jun 2020 19:11:03 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> modules/javafx.graphics/src/main/java/com/sun/javafx/font/freetype/PangoGlyphLayout.java line 148:
>>> 147:         long utflen = OSPango.g_utf8_strlen(str,-1);
>>> 148:         long end = OSPango.g_utf8_offset_to_pointer(str, utflen);
>>> 149:         long runs = OSPango.pango_itemize(context, str, (int)(start - str), (int)(end - start), attrList, 0);
>> Since you are now creating `n` native strings, 1 per substring based on the `TextRun`, rather than 1 for the entire
>> String, isn't the `start` pointer wrong? Unless I am missing something, I would think that `start` should be set to
>> `str`.
> I did a quick test, and setting `start = str` fixes the spurious assertions and intermittent crash.

I should add that this is without any attempt to filter out `0` chars. Both `UnicodeTextTest` and  `UnicodeTextTest2`
run correctly with no crashes and no assertions when I comment out the (ineffective) loop checking for 0 and set `start
= str` leaving everything else as you have it in the current PR. Loading https://gluonhq.com/ in WebView works, too.


PR: https://git.openjdk.java.net/jfx/pull/249

More information about the openjfx-dev mailing list