]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: Fix potential assert-crash when cache compression merges bitmasks
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 24 Oct 2019 11:08:01 +0000 (14:08 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Wed, 20 Nov 2019 06:26:06 +0000 (06:26 +0000)
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)

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

index c27d188288baf807571a16288927a622188c44ad..3a648db1e7a519d6489900287441f75839f2de56 100644 (file)
@@ -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;