changeset 7597:f27e6f583817 HEAD

If cached message part showed header's size to be smaller than in reality, return "broken" instead of assert-crashing.
author Timo Sirainen <tss@iki.fi>
date Mon, 02 Jun 2008 21:06:27 +0300
parents 60733457ea20
children 50120b047f0a
files src/lib-mail/message-parser.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-mail/message-parser.c	Mon Jun 02 21:00:49 2008 +0300
+++ b/src/lib-mail/message-parser.c	Mon Jun 02 21:06:27 2008 +0300
@@ -617,7 +617,11 @@
 	uoff_t offset = ctx->part->physical_pos +
 		ctx->part->header_size.physical_size;
 
-	i_assert(offset >= ctx->input->v_offset);
+	if (offset < ctx->input->v_offset) {
+		/* header was actually larger than the cached size suggested */
+		ctx->broken = TRUE;
+		return -1;
+	}
 	i_stream_skip(ctx->input, offset - ctx->input->v_offset);
 
 	ctx->parse_next_block = preparsed_parse_body_more;