]> git.ipfire.org Git - thirdparty/dovecot/core.git/commit
lib-storage: Fix bodystructure parsing crash if header is parsed twice
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 25 Jul 2018 10:17:45 +0000 (13:17 +0300)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Fri, 25 Jan 2019 09:33:37 +0000 (11:33 +0200)
commit1ddf753ae6e06686e38df047c42850e31fc39601
tree13d0b326d552bd2e3cab30313a8ba8a7610e35e0
parent0fabf67d95d55ff18ddc3d84aa25350b2c4ed171
lib-storage: Fix bodystructure parsing crash if header is parsed twice

The second parsing will recreate the parser_ctx, discarding the old parsed
message_part.data for the header. On the second parsing
save_bodystructure_header=FALSE so the message_part.data isn't filled for
the header. Later on the bodystructure parsing assumes the data is set,
and crashes.

This only happened with mail_attachment_detection_options=add-flags-on-save
and Sieve script that first accessed a non-cached header and then used the
"body" extension.

Fixes segfault and also:
Panic: file imap-bodystructure.c: line 116 (part_write_body_multipart): assertion failed: (part->data != NULL)
src/lib-storage/index/index-mail-headers.c
src/lib-storage/index/index-mail.c
src/lib-storage/index/index-mail.h