From: Timo Sirainen Date: Mon, 25 Oct 2021 12:43:00 +0000 (+0300) Subject: lib-storage: Don't use cached message_parts while message is being parsed X-Git-Tag: 2.3.19~66 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=974e970889b7f0857c55fdf8e9b0caf9c5190a93;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: Don't use cached message_parts while message is being parsed Finish the parsing instead. Otherwise there can be some confusion about parsed_bodystructure* fields, which indicate that data->parts have the bodystructure info while in reality data->parts came from cached fields and they have no bodystructure info. --- diff --git a/src/lib-storage/index/index-mail.c b/src/lib-storage/index/index-mail.c index 7e0b6f81ac..48122b1673 100644 --- a/src/lib-storage/index/index-mail.c +++ b/src/lib-storage/index/index-mail.c @@ -162,6 +162,12 @@ static bool get_cached_parts(struct index_mail *mail) if (mail->data.parts != NULL) return TRUE; + if (mail->data.parser_ctx != NULL) { + /* Message is already being parsed. Get the message parts by + finishing its parsing, so there won't be any confusion about + whether e.g. data->parsed_bodystructure=TRUE match data->parts */ + return FALSE; + } T_BEGIN { part = get_unserialized_parts(mail);