GNU bug report logs - #41520
28.0.50; Crash in character.h due to assertion error

Previous Next

Package: emacs;

Reported by: Stefan Kangas <stefan <at> marxist.se>

Date: Mon, 25 May 2020 07:06:01 UTC

Severity: normal

Found in version 28.0.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 41520 <at> debbugs.gnu.org (full text, mbox):

From: Pip Cet <pipcet <at> gmail.com>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 41520 <at> debbugs.gnu.org
Subject: Re: bug#41520: 28.0.50; Crash in character.h due to assertion error
Date: Mon, 25 May 2020 07:28:23 +0000
On Mon, May 25, 2020 at 7:06 AM Stefan Kangas <stefan <at> marxist.se> wrote:
> When editing an org-mode document, I saw a crash due to this assertion
> error:

It's a bug in this code in xdisp.c:

  else if (it->bidi_it.charpos == bob
       || (!string_p
           && (FETCH_CHAR (it->bidi_it.bytepos - 1) == '\n'
           || FETCH_CHAR (it->bidi_it.bytepos) == '\n')))

The first FETCH_CHAR should be a FETCH_BYTE to avoid the assertion error.

There's at least one other place that has the same error, so I'll grep
some more before sending a patch.

My suggestion is to drop the "eassume" on emacs-27, and fix FETCH_CHAR
to FETCH_BYTE on master.

(I'd like to reiterate my proposal to use a pos_t for bytepos/charpos
pairs, which would catch or silently fix (which happened in this case
on my pos_t branch) such bugs. The code on my branch reads:

  else if (POS_CHAR_EQUAL (it->bidi_it.pos, bob)
       || (!string_p
           && (FETCH_CHAR (dec_pos (it->bidi_it.pos)) == '\n'
           || FETCH_CHAR (it->bidi_it.pos) == '\n')))

which, while minimally slower, doesn't throw assertion errors.)




This bug report was last modified 4 years and 240 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.