Eli Zaretskii writes: >> From: >> Date: Wed, 14 Jul 2021 18:40:57 +0200 >> >> Emacs crashed when visiting specific pages in a browser using EXWM. >> Turns out this was triggered when the buffer was renamed accordingly. >> During redisplay, the crash happens for certain strings which are set as >> `mode-line-format`. I created an example to reproduce this with a stock >> Emacs configuration, see the attached elisp file. For me, this only >> triggers when the window is large enough, I suspect smaller windows will >> prevent the problematic part of the mode-line-format string to be >> processed. > > The "evil" mode-line string includes invalid use of bidi formatting > controls: you have there a U+202A LEFT-TO-RIGHT EMBEDDING without a > matching U+202C POP DIRECTIONAL FORMATTING. Removing the former or > adding the latter avoids the crash. Thanks for finding the cause! It turns out, the control chars are actually already in the window title of the browser window. The imbalance results from truncating the name to a certain length. Is there any built-in functionality to either 1. "sanitize" a string to remove bidi formatting in a sane way, or 2. have `substring` functionality that can somehow deal with these formatting controls, or 3. restore balance of a possibly broken bidi formatted string? -- Martin BrĂ¼stel Research Assistant TU Dresden, Processor Design Chair, Center for Advancing Electronics Dresden (cfaed) Tel: +49 351 43726