Subject: bug#29843: 25.3; Emacs crash when running emacsclient

From: Eli Zaretskii <[email-masked]>
Date: Mon, 25 Dec 2017 18:03:41 +0200

> From: Mike Kupfer <[email-masked]>
> Date: Sun, 24 Dec 2017 12:29:06 -0800
> 
> I ran "emacsclient -c" to get a new Emacs frame on a system running MATE
> on Debian 9.  IIRC, a new frame appeared for a split second and then
> disappeared.  (I'm afraid the crash happened a few days ago and I'm just
> now getting to filing the bug report.)  I found a core file; gdb says
> there was a segmentation fault.  This is the first and only time I've
> seen such a crash.
> 
> I'll hold onto the core file for a couple weeks in case there is
> additional information to extract from it.
> 
> (gdb) bt full
> #0  0x00007f0441b83f9f in raise () from /lib/x86_64-linux-gnu/libpthread.so.0
> No symbol table info available.
> #1  0x00000000004d99d1 in terminate_due_to_signal (sig=sig@entry=11, 
>     backtrace_limit=backtrace_limit@entry=40) at emacs.c:381
> No locals.
> #2  0x00000000004f14ce in handle_fatal_signal (sig=sig@entry=11)
>     at sysdep.c:1601
> No locals.
> #3  0x00000000004f16d9 in deliver_thread_signal (sig=sig@entry=11, 
>     handler=0x4f14c0 <handle_fatal_signal>) at sysdep.c:1575
> No locals.
> #4  0x00000000004f173f in deliver_fatal_thread_signal (sig=11) at sysdep.c:1613
> No locals.
> #5  handle_sigsegv (sig=11, siginfo=<optimized out>, arg=<optimized out>)
>     at sysdep.c:1695
>         fatal = <optimized out>
> #6  <signal handler called>
> No symbol table info available.
> #7  reconsider_clip_changes (w=w@entry=0x3764378) at xdisp.c:13452

This segfault is here:

  static void
  reconsider_clip_changes (struct window *w)
  {
    struct buffer *b = XBUFFER (w->contents);

    if (b->clip_changed
	&& w->window_end_valid
	&& w->current_matrix->buffer == b
	&& w->current_matrix->zv == BUF_ZV (b)
	&& w->current_matrix->begv == BUF_BEGV (b))   <<<<<<<<<<<<<<<<<<
      b->clip_changed = false;

So either w or b is a NULL or garbled pointer.  Can you tell which
one?  (Let me know if you need help with GDB commands to do that.)

Thanks.