On Fri, Aug 13, 2010 at 01:12:59AM +0200, Michael Hanselmann wrote:
This patch tries to detect such cases and logs them to the debug log (similar to a content-length check for mbox files).
+ if (h->content->length > 0 &&
+ (h->content->offset + h->content->length) != st.st_size)
+ {
+ dprint (1, (debugfile, "maildir_parse_message: bad content-length "
+ "in message %d (cl=" OFF_T_FMT ")\n",
+ h->index, h->content->length));
+ h->content->length = -1;
+ }
+
if (h->content->length <= 0)
h->content->length = st.st_size - h->content->offset;
I think this whole block can be reduced to always setting h->content->length. All the necessary information is there, and I don't see any other place where it is adjusted.
It is curious how the corruption happened, however. It appears something damaged the cache itself.
Thanks for the report. me