dovecot-1.1: Sort indexes: Don't assert-crash with broken sort IDs.

dovecot at dovecot.org dovecot at dovecot.org
Sat Sep 13 11:56:03 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.1/rev/12670c6d0c10
changeset: 7880:12670c6d0c10
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Sep 13 11:55:59 2008 +0300
description:
Sort indexes: Don't assert-crash with broken sort IDs.

diffstat:

1 file changed, 5 insertions(+), 1 deletion(-)
src/lib-storage/index/index-sort-string.c |    6 +++++-

diffs (16 lines):

diff -r 984f8a9d5a71 -r 12670c6d0c10 src/lib-storage/index/index-sort-string.c
--- a/src/lib-storage/index/index-sort-string.c	Thu Sep 11 23:16:09 2008 +0300
+++ b/src/lib-storage/index/index-sort-string.c	Sat Sep 13 11:55:59 2008 +0300
@@ -607,7 +607,11 @@ index_sort_add_ids_range(struct sort_str
 			   messages */
 			skip = (right_sort_id - left_sort_id) /
 				(right_idx - i + 2);
-			i_assert(skip > 0);
+			if (skip == 0) {
+				/* broken sort IDs (we previously assigned
+				   left_sort_id=right_sort_id) */
+				return -1;
+			}
 			left_sort_id += skip;
 			i_assert(left_sort_id < right_sort_id);
 


More information about the dovecot-cvs mailing list