]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: mail_search_args_init() - Fix converting UIDSET * to SEQSET on empty...
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 18 May 2020 09:01:44 +0000 (12:01 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 26 May 2020 16:32:40 +0000 (19:32 +0300)
The "*" caused seq=0 to be added to the seqset. This could have caused
unexpected issues.

Fixes at least UID MOVE on empty mailbox:
Panic: file seq-range-array.c: line 471 (seq_range_array_invert): assertion failed: (range[0].seq1 >= min_seq)

Before 1a5d89d2bfa031903e88af9aff7eafc1b373d521 this assert-crash didn't
happen, but it went to infinite loop.

src/lib-storage/mail-search.c

index 85ef23802f7a26be8469335d34f3a539c4531812..b347207179b869fc6dc4c7d3ad27d386f54bfa25 100644 (file)
@@ -53,7 +53,8 @@ mailbox_uidset_change(struct mail_search_arg *arg, struct mailbox *box,
                        /* make sure the last message is in the range */
                        mailbox_get_seq_range(box, 1, (uint32_t)-1,
                                              &seq1, &seq2);
-                       seq_range_array_add(&arg->value.seqset, seq2);
+                       if (seq2 != 0)
+                               seq_range_array_add(&arg->value.seqset, seq2);
                }
        }
 }