# HG changeset patch # User Timo Sirainen # Date 1508413141 -10800 # Node ID a91a473c65f782e2ba1b0cfa0268b993987c46ca # Parent 71665d0c138200d2343ce796962148259834e985 lib-storage: Fix assert-crash when searching header and MIMEPART For now this is just a bit kludgy workaround. The proper fix requires larger changes, which aren't worth the effort right now. For example: doveadm fetch -u testuser uid MAILBOX inbox FROM foo MIMEPART FILENAME CONTAINS bar BODY baz Crashes with: Panic: file index-mail-headers.c: line 294 (index_mail_parse_header): assertion failed: (part != NULL) diff -r 71665d0c1382 -r a91a473c65f7 src/lib-storage/index/index-search.c --- a/src/lib-storage/index/index-search.c Thu Oct 19 15:39:28 2017 +0300 +++ b/src/lib-storage/index/index-search.c Thu Oct 19 14:39:01 2017 +0300 @@ -768,7 +768,17 @@ search_cur_mail_failed(ctx); failed = TRUE; } else { + /* FIXME: The header parsing here is an optimization to + avoid parsing the header twice: First when checking + whether the search matches, and secondly when + generating wanted fields. However, if we already + know that we want to generate a BODYSTRUCTURE reply, + index_mail_parse_header() must have a non-NULL part + parameter. That's not easily possible at this point + without larger code changes, so for now we'll just + disable this optimization for that case. */ hdr_ctx.parse_headers = + !hdr_ctx.imail->data.save_bodystructure_header && index_mail_want_parse_headers(hdr_ctx.imail); if (hdr_ctx.parse_headers) { index_mail_parse_header_init(hdr_ctx.imail,