dovecot-1.2: lib-index: Give a better error message if transctio...

dovecot at dovecot.org dovecot at dovecot.org
Fri May 14 17:29:30 EEST 2010


details:   http://hg.dovecot.org/dovecot-1.2/rev/46d3128626b7
changeset: 9568:46d3128626b7
user:      Timo Sirainen <tss at iki.fi>
date:      Fri May 14 16:18:03 2010 +0200
description:
lib-index: Give a better error message if transction log file shrinks unexpectedly.

diffstat:

 src/lib-index/mail-transaction-log-file.c |  6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diffs (16 lines):

diff -r 2cdfcca171d8 -r 46d3128626b7 src/lib-index/mail-transaction-log-file.c
--- a/src/lib-index/mail-transaction-log-file.c	Mon May 10 11:05:58 2010 +0300
+++ b/src/lib-index/mail-transaction-log-file.c	Fri May 14 16:18:03 2010 +0200
@@ -1135,6 +1135,12 @@
 	i_assert(file->sync_offset >= file->buffer_offset);
 
 	data = buffer_get_data(file->buffer, &size);
+	if (file->buffer_offset + size < file->sync_offset) {
+		mail_transaction_log_file_set_corrupted(file,
+			"log file shrank (%"PRIuUOFF_T" < %"PRIuUOFF_T")",
+			file->buffer_offset + (uoff_t)size, file->sync_offset);
+		return -1;
+	}
 	while (file->sync_offset - file->buffer_offset + sizeof(*hdr) <= size) {
 		hdr = CONST_PTR_OFFSET(data, file->sync_offset -
 				       file->buffer_offset);


More information about the dovecot-cvs mailing list