dovecot-2.2: lib-index: Added asserts to make sure invalid exten...

dovecot at dovecot.org dovecot at dovecot.org
Fri May 22 20:39:19 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/fd8edab94849
changeset: 18738:fd8edab94849
user:      Timo Sirainen <tss at iki.fi>
date:      Fri May 22 16:37:07 2015 -0400
description:
lib-index: Added asserts to make sure invalid extension records aren't written to log.

diffstat:

 src/lib-index/mail-index-transaction-export.c |  1 +
 src/lib-index/mail-index-transaction-update.c |  1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diffs (22 lines):

diff -r 8906101589f9 -r fd8edab94849 src/lib-index/mail-index-transaction-export.c
--- a/src/lib-index/mail-index-transaction-export.c	Thu May 21 22:41:43 2015 -0400
+++ b/src/lib-index/mail-index-transaction-export.c	Fri May 22 16:37:07 2015 -0400
@@ -164,6 +164,7 @@
 				intro->hdr_size = hdr_update_size;
 		}
 	}
+	i_assert(intro->record_size != 0 || intro->hdr_size != 0);
 	if (reset_id != 0) {
 		/* we're going to reset this extension in this transaction */
 		intro->reset_id = reset_id;
diff -r 8906101589f9 -r fd8edab94849 src/lib-index/mail-index-transaction-update.c
--- a/src/lib-index/mail-index-transaction-update.c	Thu May 21 22:41:43 2015 -0400
+++ b/src/lib-index/mail-index-transaction-update.c	Fri May 22 16:37:07 2015 -0400
@@ -979,6 +979,7 @@
 		rext = array_idx(&index->extensions, ext_id);
 		record_size = rext->record_size;
 	}
+	i_assert(record_size > 0);
 
 	if (!array_is_created(&t->ext_rec_updates))
 		i_array_init(&t->ext_rec_updates, ext_id + 2);


More information about the dovecot-cvs mailing list