On 18 Oct 2019, at 15.36, Erik de Waard via dovecot <dovecot@dovecot.org> wrote:

Hi, i'm getting a coredump on a specific msg, i've attached the gdb.

file on disk i noticed W=<vsize> is missing.
1571209735.M744550P1608.rwvirtual65,S=15886:2,S
..
mail.log
Oct 18 14:41:39 rwvirtual10 dovecot: imap(johndoe@company.nl)<15868><qjTFpy6VPsMKAAok>: Error: Mailbox INBOX.Debug: UID=1041: read(/data/mail/company.nl/users/johndoe/Maildir/.Debug/cur/1571209735.M744550P1608.rwvirtual65,S=15886:2,S) failed: Cached message size smaller than expected (15886 < 16367, box=INBOX.Debug, UID=1041) (read reason=mail stream)
Oct 18 14:41:39 rwvirtual10 dovecot: imap(johndoe@company.nl)<15868><qjTFpy6VPsMKAAok>: Error: Corrupted record in index cache file /data/indexes/johndoe@company.nl/.Debug/dovecot.index.cache: UID 1041: Broken physical size in mailbox INBOX.Debug: read(/data/mail/company.nl/users/johndoe/Maildir/.Debug/cur/1571209735.M744550P1608.rwvirtual65,S=15886:2,S) failed: Cached message size smaller than expected (15886 < 16367, box=INBOX.Debug, UID=1041)
Oct 18 14:41:39 rwvirtual10 dovecot: imap(johndoe@company.nl)<15868><qjTFpy6VPsMKAAok>: Panic: file istream.c: line 315 (i_stream_read_memarea): assertion failed: (old_size <= _stream->pos - _stream->skip)

The missing W shouldn't matter, but the S size is wrong. So the error is expected, but the panic isn't. I tried to reproduce this, but I couldn't get the panic to happen. Do you still have the file? Could you send it to me? You can also put it through https://dovecot.org/tools/maildir-obfuscate.pl which should remove all sensitive content but hopefully still contain enough to reproduce the bug.