]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: Fix potential assert-crash when reading cache
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 24 Oct 2016 09:25:48 +0000 (12:25 +0300)
committerGitLab <gitlab@git.dovecot.net>
Mon, 24 Oct 2016 09:46:00 +0000 (12:46 +0300)
Fixes:
Panic: file mail-cache-lookup.c: line 258 (mail_cache_lookup_iter_next): assertion failed: (ctx->offset != 0)

Broken by d33fc6c584718efd46159e1d8f46488b9dfc66f5

src/lib-index/mail-cache-lookup.c

index a29f209215e64de9248d772c562b40e85a43ed11..53be843baa9bb9df9826686d8a885efb48d35dcf 100644 (file)
@@ -199,7 +199,7 @@ mail_cache_lookup_iter_next_record(struct mail_cache_lookup_iterate_ctx *ctx)
                                return 1;
                        ctx->memory_appends_checked = TRUE;
                }
-               if (MAIL_CACHE_IS_UNUSABLE(view->cache))
+               if (MAIL_CACHE_IS_UNUSABLE(view->cache) || ctx->stop)
                        return 0;
 
                /* check data already written to cache file */