On Sun, Sep 23, 2012 at 10:29:57PM -0700, Andrew Gaul wrote:
# HG changeset patch
# User Andrew Gaul <and...@gaul.org>
# Date 1348464567 25200
# Branch HEAD
# Node ID 3d3f1fb09ef6dcb52393e4d68b0a8d1e2242efea
# Parent 70810a88ce9feb66d5c74e7ec3f2a633bd8b5312
Guard against NULL dereference in mutt_parent_message
Seen when switching IMAP accounts:
Program terminated with signal 11, Segmentation fault.
#0 0x000000000048dbfa in mutt_parent_message (ctx=0x2cb9870, hdr=0x0)
at thread.c:1087
1087 for (thread = hdr->thread->parent; thread; thread = thread->parent)
(gdb) bt
#0 0x000000000048dbfa in mutt_parent_message (ctx=0x2cb9870, hdr=0x0)
at thread.c:1087
#1 0x00000000004236a9 in resort_index (menu=0x271bed0) at curs_main.c:396
#2 0x000000000042384e in mutt_index_menu () at curs_main.c:456
#3 0x0000000000449b13 in main (argc=1, argv=0x7fff68a4e528) at main.c:1020
(gdb) print hdr
$1 = (HEADER *) 0x0
This looks like a bug elsewhere, and I think this patch is just
covering up the symptom. There is a NULL pointer in Context->hdrs
where there should not be, so something did not get cleaned up
properly. resort_index() is only called when we are in a
non-empty mailbox.