[dev] [libsl] crashes when redering emojis

From: Sören Tempel <soeren_AT_soeren-tempel.net>
Date: Tue, 17 Jan 2017 20:47:09 +0100

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.


[1]: https://github.com/googlei18n/noto-emoji
Received on Tue Jan 17 2017 - 20:47:09 CET

This archive was generated by hypermail 2.3.0 : Tue Jan 17 2017 - 20:48:13 CET