Subject: 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 15:12:31 -0400

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

>
> So the window's start point is outdated.  How did that happen?  What
> kind of stuff do you have on window-scroll-functions?  This should
> show us:
>
>   (gdb) pp Vwindow_scroll_functions
>

Seems like that caused gdb to crash again?

(gdb) pp Vwindow_scroll_functions

xdisp.c:3047: Emacs fatal error: assertion failed: charpos == BYTE_TO_CHAR
(bytepos)

Thread 1 "emacs" hit Breakpoint 1, terminate_due_to_signal (sig=sig@entry=6,
    backtrace_limit=backtrace_limit@entry=2147483647) at emacs.c:375
375     {
The program being debugged stopped while in a function called from GDB.
Evaluation of the expression containing the function
(safe_debug_print) will be abandoned.
When the function is done executing, GDB will silently stop.
(gdb)

But from an uncrashed emacs, with beacon loaded as before, C-h v
window-scroll-functions gives ...

(beacon--window-scroll-function)

beacon--window-scroll-function:
http://git.savannah.gnu.org/cgit/emacs/elpa.git/tree/packages/beacon/beacon.el#n425

> Also, what buffer does the window-start marker record?
>
>   (gdb) fr 2
>   (gdb) p w->start
>   (gdb) xmarker
>   (gdb) p $->buffer->name_
>   (gdb) xstring
>

(gdb) pp Vwindow_scroll_functions

xdisp.c:3047: Emacs fatal error: assertion failed: charpos == BYTE_TO_CHAR
(bytepos)

Thread 1 "emacs" hit Breakpoint 1, terminate_due_to_signal (sig=sig@entry=6,
    backtrace_limit=backtrace_limit@entry=2147483647) at emacs.c:375
375     {
The program being debugged stopped while in a function called from GDB.
Evaluation of the expression containing the function
(safe_debug_print) will be abandoned.
When the function is done executing, GDB will silently stop.
(gdb) fr 2
#2  0x0000000000456b44 in init_iterator (it=it@entry=0x7ffffffef990,
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->start
$16 = XIL(0x89daa95)
(gdb) xmarker
$17 = (struct Lisp_Marker *) 0x89daa90
(gdb) p $->buffer->name_
$18 = XIL(0x7960234)
(gdb) xstring
$19 = (struct Lisp_String *) 0x7960230
"standard-reading.org"
(gdb)

That "standard-reading.org" is the Org file whose ~3000 character snippet
that I linked earlier.