2017-01-17 19:47:09 UTC
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 . 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.