#3569: Segmentation fault in sync_helper
--------------------+-------------------------------------------------------
Reporter: hhorak | Owner: mutt-dev
Type: defect | Status: new
Priority: major | Milestone:
Component: mutt | Version: 1.5.21
Keywords: |
--------------------+-------------------------------------------------------
Mutt sometimes crashes in sync_helper (imap.c:1131) because of a
segmentation fault. Regarding the backtrace it fails because idata->ctx is
NULL, which is not expected at this point, but seeing many similar
failures in [1], [2] and [3], it really happens.
What we know from bug reports, it usually happens after many changes in
the imap folder or after imap server failure occurs. I suspect mutt to
erased idata->ctx after it fails to communicate with imap server, but I
don't know how to reproduce it.
There are many checks of idata->ctx to be set before working with it in
other places, so I'd suggest to add a check into sync_helper as well, for
example as the following:
{{{
diff -up mutt-1.5.21/imap/imap.c.syncdebug mutt-1.5.21/imap/imap.c
--- mutt-1.5.21/imap/imap.c.syncdebug 2012-03-27 10:05:44.978962551
+0200
+++ mutt-1.5.21/imap/imap.c 2012-03-27 10:05:54.223252267 +0200
@@ -1128,7 +1128,7 @@ static int sync_helper (IMAP_DATA* idata
char buf[LONG_STRING];
- if (!mutt_bit_isset (idata->ctx->rights, right))
+ if (!idata->ctx || !mutt_bit_isset (idata->ctx->rights, right))
return 0;
if (right == M_ACL_WRITE && !imap_has_flag (idata->flags, name))
}}}
I know this doesn't fix the issue itself, but I still think it can be
sufficient here.
Thanks for consideration and any comments are welcome.
{{{
[1] https://bugzilla.redhat.com/show_bug.cgi?id=691719
[2] https://bugzilla.redhat.com/show_bug.cgi?id=801277
[3] https://bugzilla.redhat.com/show_bug.cgi?id=640453
}}}
--
Ticket URL: <http://dev.mutt.org/trac/ticket/3569>
Mutt <http://www.mutt.org/>
The Mutt mail user agent