From: Timo Sirainen Date: Thu, 12 Dec 2019 10:30:37 +0000 (+0200) Subject: lib-index: Fix potential crash when view is synced after index is reset X-Git-Tag: 2.3.10~182 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=89b45a6e2e6ba2bfc7e2b6de5fb863baffe0e5c6;p=thirdparty%2Fdovecot%2Fcore.git lib-index: Fix potential crash when view is synced after index is reset view_sync_set_log_view_range() sees that index is reset, so it clears the log_view, which sets log_view->cur=NULL. Later on view_sync_have_expunges() calls mail_transaction_log_view_mark(), which crashes because log_view->cur==NULL. This crash mainly happened when searching for seen flags in a newly created mailbox with INDEXPVT. This commit doesn't actually fix the bug, but it fixes the resulting crash. --- diff --git a/src/lib-index/mail-index-view-sync.c b/src/lib-index/mail-index-view-sync.c index 4da205ad8b..92ebede45f 100644 --- a/src/lib-index/mail-index-view-sync.c +++ b/src/lib-index/mail-index-view-sync.c @@ -227,6 +227,9 @@ static bool view_sync_have_expunges(struct mail_index_view *view) bool have_expunges = FALSE; int ret; + if (mail_transaction_log_view_is_last(view->log_view)) + return FALSE; + mail_transaction_log_view_mark(view->log_view); while ((ret = mail_transaction_log_view_next(view->log_view,