From: Josef 'Jeff' Sipek Date: Mon, 18 Sep 2017 13:48:41 +0000 (+0300) Subject: lib-index: fix off-by-one in index flag update test X-Git-Tag: 2.3.0.rc1~994 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fda9c7fe9df0f51ccc96b92b19c1f287c61c4d30;p=thirdparty%2Fdovecot%2Fcore.git lib-index: fix off-by-one in index flag update test When selecting the second seq, the max value we should generate is hdr.messages_count - not one less than that. --- diff --git a/src/lib-index/test-mail-index-transaction-update.c b/src/lib-index/test-mail-index-transaction-update.c index af9067b719..0b90cc198e 100644 --- a/src/lib-index/test-mail-index-transaction-update.c +++ b/src/lib-index/test-mail-index-transaction-update.c @@ -347,7 +347,7 @@ static void test_mail_index_flag_update_random(void) change = i_rand() % (MAIL_FLAGS_NONRECENT+1); seq1 = (i_rand() % hdr.messages_count) + 1; seq2 = seq1 == hdr.messages_count ? seq1 : - (i_rand() % (hdr.messages_count - seq1)) + seq1; + (i_rand() % (hdr.messages_count - seq1 + 1)) + seq1; switch (i_rand() % 3) { case 0: