Mercurial > dovecot > core-2.2
changeset 20514:fe9ed1aa41ad
mdbox: Fixed crash when saving POP3 UIDLs to a non-empty mailbox.
Fixes assert:
Panic: file mdbox-save.c: line 337: unreached
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Mon, 11 Jul 2016 11:55:34 +0300 |
parents | 56666f12cfb7 |
children | 84cd7e08e8d6 |
files | src/lib-storage/index/dbox-multi/mdbox-save.c |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/dbox-multi/mdbox-save.c Mon Jul 11 11:40:41 2016 +0300 +++ b/src/lib-storage/index/dbox-multi/mdbox-save.c Mon Jul 11 11:55:34 2016 +0300 @@ -328,12 +328,18 @@ &_t->changes->saved_uids); if (ctx->ctx.highest_pop3_uidl_seq != 0) { + const struct dbox_save_mail *mails; struct seq_range_iter iter; + unsigned int highest_pop3_uidl_idx; uint32_t uid; + mails = array_idx(&ctx->mails, 0); + highest_pop3_uidl_idx = + ctx->ctx.highest_pop3_uidl_seq - mails[0].seq; + i_assert(mails[highest_pop3_uidl_idx].seq == ctx->ctx.highest_pop3_uidl_seq); + seq_range_array_iter_init(&iter, &_t->changes->saved_uids); - if (!seq_range_array_iter_nth(&iter, - ctx->ctx.highest_pop3_uidl_seq-1, &uid)) + if (!seq_range_array_iter_nth(&iter, highest_pop3_uidl_idx, &uid)) i_unreached(); index_pop3_uidl_set_max_uid(&ctx->mbox->box, ctx->ctx.trans, uid); }