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

From: Mike Kupfer <[email-masked]>
Date: Mon, 25 Dec 2017 10:22:16 -0800

Eli Zaretskii wrote:

> 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.)

Hmm, I'm guessing that b is null.  w->contents is zero, but I'm having
some trouble figuring out what XBUFFER(0) would return, and gdb won't
display b directly.  I can't tell if w is garbled.

(gdb) up 7
#7  reconsider_clip_changes (w=w@entry=0x3764378) at xdisp.c:13452
13452	  if (b->clip_changed
(gdb) print w
$1 = (struct window *) 0x3764378
(gdb) print *w
$2 = {header = {size = 4611686018494648343}, frame = 58081653, 
  next = 58082661, prev = 0, parent = 0, normal_lines = 72039007, 
  normal_cols = 72038999, new_total = 2, new_normal = 2, new_pixel = 2, 
  contents = 0, start = 55248673, pointm = 55248593, old_pointm = 55248553, 
  temslot = 0, vertical_scroll_bar = 0, vertical_scroll_bar_type = 43344, 
  horizontal_scroll_bar = 0, horizontal_scroll_bar_type = 43344, 
  display_table = 0, dedicated = 0, redisplay_end_trigger = 0, 
  combination_limit = 112076805, window_parameters = 0, current_matrix = 0x0, 
  desired_matrix = 0x0, prev_buffers = 115608467, next_buffers = 0, 
  use_time = 2567, sequence_number = 151, pixel_left = 0, pixel_top = 0, 
  left_col = 0, top_line = 0, pixel_width = 672, pixel_height = 560, 
  total_cols = 84, total_lines = 35, hscroll = 0, min_hscroll = 0, 
  hscroll_whole = 0, last_modified = 98, last_overlay_modified = 35, 
  last_point = 1, base_line_number = 0, base_line_pos = 0, 
  column_number_displayed = -1, nrows_scale_factor = 1, 
  ncols_scale_factor = 1, cursor = {x = 0, y = 0, hpos = 0, vpos = 0}, 
  phys_cursor = {x = 0, y = 0, hpos = 0, vpos = 0}, output_cursor = {x = 0, 
    y = 0, hpos = 0, vpos = 0}, last_cursor_vpos = 0, 
  phys_cursor_type = NO_CURSOR, phys_cursor_width = -1, 
  phys_cursor_ascent = 0, phys_cursor_height = 0, left_fringe_width = -1, 
  right_fringe_width = -1, left_margin_cols = 0, right_margin_cols = 0, 
  scroll_bar_width = -1, scroll_bar_height = -1, mode_line_height = 16, 
  header_line_height = -1, window_end_pos = 0, window_end_vpos = 14, 
  mini = false, horizontal = false, update_mode_line = false, 
  last_had_star = false, start_at_line_beg = true, force_start = false, 
  optional_new_start = false, phys_cursor_on_p = false, cursor_off_p = false, 
  last_cursor_off_p = false, must_be_updated_p = false, 
  pseudo_window_p = false, fringes_outside_margins = false, 
  window_end_valid = false, redisplay = true, suspend_auto_hscroll = false, 
  vscroll = 0, window_end_bytepos = 0}
(gdb) print b
$3 = <optimized out>
(gdb) print w.contents
$4 = 0
[...]
(gdb) print w.window_end_valid
$6 = false
(gdb) print w.current_matrix
$7 = (struct glyph_matrix *) 0x0
(gdb) print /x w.header.size
$8 = 0x4000000004025017

mike