changeset 8180:f6838eb4e0e6 HEAD

Don't crash if trying to reset an extension which had a broken intro record.
author Timo Sirainen <tss@iki.fi>
date Tue, 09 Sep 2008 17:35:39 +0300
parents 414b6a5c35db
children 5c0c674eae1a
files src/lib-index/mail-index-sync-ext.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-index-sync-ext.c	Tue Sep 09 11:46:18 2008 +0300
+++ b/src/lib-index/mail-index-sync-ext.c	Tue Sep 09 17:35:39 2008 +0300
@@ -464,7 +464,7 @@
 
 	/* default to ignoring the following extension updates in case this
 	   intro is corrupted */
-	ctx->cur_ext_map_idx = 0;
+	ctx->cur_ext_map_idx = (uint32_t)-2;
 	ctx->cur_ext_ignore = TRUE;
 
 	if (u->ext_id != (uint32_t)-1 &&
@@ -578,6 +578,10 @@
 			"Extension reset without intro prefix");
 		return -1;
 	}
+	if (ctx->cur_ext_map_idx == (uint32_t)-2 && ctx->cur_ext_ignore) {
+		/* previous extension intro was broken */
+		return -1;
+	}
 	/* since we're resetting the extension, don't check cur_ext_ignore */
 
 	/* a new index file will be created, so the old data won't be