On 02 Nov 2015, at 22:12, Robert L Mathews lists@tigertech.com wrote:
On 10/30/15 3:06 PM, Robert L Mathews wrote:
I've noticed that maildir IMAP COPY commands can generate invalid dovecot.index entries when all seven of the following are true:
As a followup to my own post, I believe I've tracked this problem down to this code at lines 119-124 of /src/plugins/zlib/zlib-plugin.c:
/* don't uncompress input when we are reading a mail that we're just in the middle of saving, and we didn't do the compression ourself. in such situation we're probably checking if the user-given input looks compressed */ if (_mail->saving && zuser->save_handler == NULL) return zmail->super.istream_opened(_mail, stream);
When these lines are removed, the problem no longer happens.
I'm guessing that an IMAP COPY with the seven circumstances I mentioned matches "we are reading a mail that we're just in the middle of saving, and we didn't do the compression ourself". But the mail apparently does need decompressing in this situation.
It seems odd for the code to not simply decompress the mail in all cases. But I'm not sure what other code relies on this check, so I have no idea whether removing these lines might cause problems.
The check is there to make sure that people can't try to exploit bugs in compression libraries by uploading something that Dovecot attempts to decompress later on. So if the input looks compressed it's simply rejected. (If zlib_save is enabled this isn't a problem, because the compressed-looking input is compressed again.)