From: Timo Sirainen Date: Thu, 8 May 2003 02:09:45 +0000 (+0300) Subject: Don't crash with invalid first_unseen_uid_lowwater X-Git-Tag: 1.1.alpha1~4672 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f1d9104a99d39122dafc1a0abc0692b97ee0006c;p=thirdparty%2Fdovecot%2Fcore.git Don't crash with invalid first_unseen_uid_lowwater --HG-- branch : HEAD --- diff --git a/src/lib-storage/index/index-status.c b/src/lib-storage/index/index-status.c index f554e61a2b..b37fc65d19 100644 --- a/src/lib-storage/index/index-status.c +++ b/src/lib-storage/index/index-status.c @@ -21,6 +21,10 @@ static unsigned int get_first_unseen_seq(struct mail_index *index) if (lowwater_uid == hdr->next_uid) { /* no unseen messages */ rec = NULL; + } else if (lowwater_uid > hdr->next_uid) { + index_set_corrupted(index, "first_unseen_uid_lowwater %u >= " + "next_uid %u", lowwater_uid, hdr->next_uid); + return 0; } else if (lowwater_uid != 0) { /* begin scanning from the low water mark */ rec = index->lookup_uid_range(index, lowwater_uid,