From: Timo Sirainen Date: Fri, 22 May 2015 20:37:07 +0000 (-0400) Subject: lib-index: Added asserts to make sure invalid extension records aren't written to... X-Git-Tag: 2.2.19.rc1~456 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=01e29d9d23a1844b4582592a473a3b3eac56b36b;p=thirdparty%2Fdovecot%2Fcore.git lib-index: Added asserts to make sure invalid extension records aren't written to log. --- diff --git a/src/lib-index/mail-index-transaction-export.c b/src/lib-index/mail-index-transaction-export.c index 692a346262..9d16c1e6b4 100644 --- a/src/lib-index/mail-index-transaction-export.c +++ b/src/lib-index/mail-index-transaction-export.c @@ -164,6 +164,7 @@ static void log_append_ext_intro(struct mail_index_export_context *ctx, intro->hdr_size = hdr_update_size; } } + i_assert(intro->record_size != 0 || intro->hdr_size != 0); if (reset_id != 0) { /* we're going to reset this extension in this transaction */ intro->reset_id = reset_id; diff --git a/src/lib-index/mail-index-transaction-update.c b/src/lib-index/mail-index-transaction-update.c index 01f1be0117..c130f904ce 100644 --- a/src/lib-index/mail-index-transaction-update.c +++ b/src/lib-index/mail-index-transaction-update.c @@ -979,6 +979,7 @@ void mail_index_update_ext(struct mail_index_transaction *t, uint32_t seq, rext = array_idx(&index->extensions, ext_id); record_size = rext->record_size; } + i_assert(record_size > 0); if (!array_is_created(&t->ext_rec_updates)) i_array_init(&t->ext_rec_updates, ext_id + 2);