unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Martin Brüstel" <martin.bruestel@tu-dresden.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 49562@debbugs.gnu.org
Subject: bug#49562: 27.2; Crash with specific mode-line-format in BiDi processing
Date: Thu, 15 Jul 2021 11:30:27 +0200	[thread overview]
Message-ID: <sa6pmvjvs98.fsf@tu-dresden.de> (raw)
In-Reply-To: <83pmvk7lty.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1551 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

>> From: <martin.bruestel@tu-dresden.de>
>> 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

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5341 bytes --]

  reply	other threads:[~2021-07-15  9:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-14 16:40 bug#49562: 27.2; Crash with specific mode-line-format in BiDi processing martin.bruestel
2021-07-14 19:10 ` Eli Zaretskii
2021-07-15  9:30   ` Martin Brüstel [this message]
2021-07-15 10:06     ` Eli Zaretskii
2021-07-18 14:31     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sa6pmvjvs98.fsf@tu-dresden.de \
    --to=martin.bruestel@tu-dresden.de \
    --cc=49562@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).