]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: Fix start_offset > sync_offset error handling for in-memory indexes
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 22 May 2017 07:11:30 +0000 (10:11 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 24 May 2017 15:10:42 +0000 (18:10 +0300)
src/lib-index/mail-transaction-log-file.c

index e1ed74d1db3f327fa89dcd3d5310eec1eb739660..2353ef41723c834a89b459f977d7eb29f3556619 100644 (file)
@@ -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;