unixwork / xnedit

A fast and classic X11 text editor, based on NEdit, with full unicode support and antialiased text rendering.
Other
83 stars 11 forks source link

inserting unicode code point outside of the BMP (?) causes xnedit to exit abruptly #127

Open lersek opened 9 months ago

lersek commented 9 months ago

This is with xnedit built at commit b1c382a ("mark iconified windows in the window menu").

When inserting a unicode character outside of the basic multilingual plane, for example the U+1F9AD Seal "🦭" character, xnedit exits with code 1, and with the following message written to stderr:

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

This happens if the Seal character is inserted via clipboard (Edit | Paste, Ctrl+V), or via Edit | Insert Unicode (Alt+Ctrl+U).

Note that my only reproducer thus far is only this particular Seal character, so when I say "code point outside of the BMP", I'm already generalizing -- which may be incorrect. It's just my assumption that xnedit limits itself to the BMP at this time. (Which is fine, but then the behavior upon insert should be more graceful.)

In order to avoid data loss, I suggest that such errors are handled explciitly -- either ignore the failed insert operation, or pop up an error message. Just don't crash :)

Thanks.

unixwork commented 9 months ago

The problem is not really, that insert fails, but some internal X11 error occurs when rendering this character, which kills the X session. It is possible that this is an libxft or an Xorg bug, but I have to look into this further.