From: Timo Sirainen Date: Mon, 22 May 2017 07:11:30 +0000 (+0300) Subject: lib-index: Fix start_offset > sync_offset error handling for in-memory indexes X-Git-Tag: 2.2.31.rc1~186 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6ad0dcf169a9f81b2ef2d70d63244f3be3e05ea0;p=thirdparty%2Fdovecot%2Fcore.git lib-index: Fix start_offset > sync_offset error handling for in-memory indexes --- diff --git a/src/lib-index/mail-transaction-log-file.c b/src/lib-index/mail-transaction-log-file.c index e1ed74d1db..2353ef4172 100644 --- a/src/lib-index/mail-transaction-log-file.c +++ b/src/lib-index/mail-transaction-log-file.c @@ -1664,6 +1664,14 @@ log_file_map_check_offsets(struct mail_transaction_log_file *file, if (start_offset > file->sync_offset) { /* broken start offset */ + if (MAIL_TRANSACTION_LOG_FILE_IN_MEMORY(file)) { + *reason_r = t_strdup_printf( + "%s: start_offset (%"PRIuUOFF_T") > " + "current sync_offset (%"PRIuUOFF_T")", + file->filepath, start_offset, file->sync_offset); + return FALSE; + } + if (fstat(file->fd, &st) < 0) { log_file_set_syscall_error(file, "fstat()"); st.st_size = -1;