Discussion:
[dev] [libsl] crashes when redering emojis
(too old to reply)
Sören Tempel
2017-01-17 19:47:09 UTC
Permalink
Hello there,

I believe I found a bug in libsl. The drw_text function from libsl
crashes with an X Error when the passed text contains an emoji. The
exact error message is the following:

X Error of failed request: BadLength (poly request too large or internal Xlib length error)
Major opcode of failed request: 138 (RENDER)
Minor opcode of failed request: 20 (RenderAddGlyphs)
Serial number of failed request: 28
Current serial number in output stream: 29

I reproduced this bug with dwm and dmenu. When using dmenu you can
reproduce this bug in the following way: First of all you will need to
have a font installed which actually supports emojis. I used Googles
noto emoji font [1]. After installing such a font it will be
automatically picked up by libsl as a fallback font for emojis (assuming
that the font you configured in config.h doesn't support them).

To reproduce the error message shown above you will then just need to
pass an emoji to dmenu over stdin. I used the clown face (U+1F921) but
different emojis should also work.

Even though the instructions above are limited to dmenu it also effects
other suckless software using libsl, for instance dwm. Among other
things dwm uses drw_text to display the title of the current window in
the topbar. This is somewhat annoying because if you open a webpage
containing an emoji in its title (assuming your web browser sets the
window title to the page title) your entire window manager will crash.

I tried to resolve the issue myself the only thing I managed to figure
out is that the Xlib function causing the crash is XftTextExtentsUtf8
which is called from drw_font_getexts (called from drw_text). However, I
I am too inexperienced with Xlib myself to come up with a patch.

Sören.

[1]: https://github.com/googlei18n/noto-emoji
Hiltjo Posthuma
2017-01-18 17:36:33 UTC
Permalink
Post by Sören Tempel
Hello there,
I believe I found a bug in libsl. The drw_text function from libsl
crashes with an X Error when the passed text contains an emoji. The
X Error of failed request: BadLength (poly request too large or internal Xlib length error)
Major opcode of failed request: 138 (RENDER)
Minor opcode of failed request: 20 (RenderAddGlyphs)
Serial number of failed request: 28
Current serial number in output stream: 29
I reproduced this bug with dwm and dmenu. When using dmenu you can
reproduce this bug in the following way: First of all you will need to
have a font installed which actually supports emojis. I used Googles
noto emoji font [1]. After installing such a font it will be
automatically picked up by libsl as a fallback font for emojis (assuming
that the font you configured in config.h doesn't support them).
To reproduce the error message shown above you will then just need to
pass an emoji to dmenu over stdin. I used the clown face (U+1F921) but
different emojis should also work.
Even though the instructions above are limited to dmenu it also effects
other suckless software using libsl, for instance dwm. Among other
things dwm uses drw_text to display the title of the current window in
the topbar. This is somewhat annoying because if you open a webpage
containing an emoji in its title (assuming your web browser sets the
window title to the page title) your entire window manager will crash.
I tried to resolve the issue myself the only thing I managed to figure
out is that the Xlib function causing the crash is XftTextExtentsUtf8
which is called from drw_font_getexts (called from drw_text). However, I
I am too inexperienced with Xlib myself to come up with a patch.
Sören.
[1]: https://github.com/googlei18n/noto-emoji
I cannot reproduce this issue, but it has been reported before.

Do you use the latest git version for dmenu? Do you have any custom patches or
changes applied?

What OS / distro and library versions do you use?

Can you provide your config.h, font configuration files and command you used
to generate the text?
--
Kind regards,
Hiltjo
Sören Tempel
2017-01-19 10:05:35 UTC
Permalink
Post by Hiltjo Posthuma
I cannot reproduce this issue, but it has been reported before.
Are you sure that you have a font installed which supports emojis? If
so: Which one? Besides: What happens if you perform the steps I outlined
in my bug report? Is the emoji rendered properly and what emoji did you
use?
Post by Hiltjo Posthuma
Do you use the latest git version for dmenu?
I can reproduce this with the lastet git version
(5cd66e2c6ca6a82e59927d495498fa6e478594d6) and the latest stable release
(4.6).
Post by Hiltjo Posthuma
Do you have any custom patches or changes applied?
I don't.
Post by Hiltjo Posthuma
What OS / distro and library versions do you use?
I can reproduce this issue under Alpine Linux and Arch Linux. I didn't
test any other operating systems. Under Alpine Linux I am using libx11
1.6.4, xinerama 1.1.3 and libxft 2.3.2.
Post by Hiltjo Posthuma
Can you provide your config.h, font configuration files and command you used
to generate the text?
I don't use a custom config.h and I don't have any custom font
configuration files either. I just use the default config files
installed by fontconfig 2.12.1.

Sören.

Continue reading on narkive:
Loading...