From: Timo Sirainen Date: Thu, 24 Oct 2019 11:08:01 +0000 (+0300) Subject: lib-index: Fix potential assert-crash when cache compression merges bitmasks X-Git-Tag: 2.3.10~289 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=80737a126f2b46696e113cd365d34163b51df549;p=thirdparty%2Fdovecot%2Fcore.git lib-index: Fix potential assert-crash when cache compression merges bitmasks Fixes: Panic: file array.c: line 10 (array_idx_modifiable_i): assertion failed: (idx < array->buffer->used / array->element_size) (although this panic could happen in other ways as well) --- diff --git a/src/lib-index/mail-cache-compress.c b/src/lib-index/mail-cache-compress.c index c27d188288..3a648db1e7 100644 --- a/src/lib-index/mail-cache-compress.c +++ b/src/lib-index/mail-cache-compress.c @@ -35,7 +35,7 @@ mail_cache_merge_bitmask(struct mail_cache_copy_context *ctx, unsigned char *dest; unsigned int i, *pos; - pos = array_idx_modifiable(&ctx->bitmask_pos, field->field_idx); + pos = array_idx_get_space(&ctx->bitmask_pos, field->field_idx); if (*pos == 0) { /* we decided to drop this field */ return;