Subject: Re: bug#35429: 27.0.50; Arbitrary xdisp.c related crashes when working with overlay-using packages

From: Kaushal Modi <[email-masked]>
Date: Fri, 26 Apr 2019 14:22:51 -0400

On Fri, Apr 26, 2019 at 2:09 PM Eli Zaretskii <[email-masked]> wrote:

> > Those characters are in the buffer, not overlay. And they are not in the
> first 2874 characters.
> > Here are the roughly first 3000 chars of that Org buffer:
> http://ix.io/1Hgv
>
> That's strange, because the data you printed in GDB says there's at
> least one non-ASCII character within the first 1406 character
> positions.
>

The results of the gdb commands explains this confusion :)

> Character code properties: customize what to show
> >   general-category: Co (Other, Private Use)
> >   decomposition: (59428) ('')
>
> Why are you using PU characters?  They will only work with specific
> fonts, not in general.  I advise against that.  But I don't think this
> is the reason, as no valid Unicode point should ever cause a crash.
>
> > (gdb) p current_buffer->pt
> > $1 = 1406
> > (gdb) p current_buffer->pt_byte
> > $2 = 1418
>
> This is inconsistent both with the image of the buffer you posted
> above and with the fact that character position 2874 corresponds to a
> byte position 2874.
>

Yes, this mapping is only for PragmataPro font. It's just because I did not
know of any other way to map to the ligature codes provided by the font.

Are you sure the current buffer is your Org buffer?

I was .. until now .. I most likely had the frame split in two windows with
one showing that Org file and the other showing ascii-art-to-unicode.el.
Here is that file:
http://git.savannah.gnu.org/cgit/emacs/elpa.git/tree/packages/ascii-art-to-unicode/ascii-art-to-unicode.el

And that file definitely has a lot of unicode characters in the first 2k
lines.

(That ties back to the box characters which I was trying to add to the Org
file.)

>   What do the
> following commands display?
>
>  (gdb) p current_buffer->name_
>  (gdb) xstring
>  (gdb) fr 2
>  (gdb) p w->contents
>  (gdb) xtype
>  (gdb) xbuffer
>

(gdb) p current_buffer->name_
$9 = XIL(0xc35be44)
(gdb) xstring
$10 = (struct Lisp_String *) 0xc35be40
"ascii-art-to-unicode.el"
(gdb) fr 2
#2  0x0000000000456b44 in init_iterator (it=it@entry=0x7fffffff3040,
w=w@entry=0x89da880, charpos=2874,
    bytepos=<optimized out>, row=<optimized out>,
base_face_id=base_face_id@entry=DEFAULT_FACE_ID)
    at xdisp.c:3047
3047          eassert (charpos == BYTE_TO_CHAR (bytepos));
(gdb) p w->contents
$11 = XIL(0xc35be95)
(gdb) xtype
Lisp_Vectorlike
PVEC_BUFFER
(gdb) xbuffer
$12 = (struct buffer *) 0xc35be90
(unsigned char *) 0xb6e97a0 "ascii-art-to-unicode.el"
(gdb)

I hope this helps.

This debug is turning out to be interesting with each update :)

Thanks.

Kaushal