[Bug 1170347] [NEW] Digest handler crashes on non-ascii messages with no encoding header
Public bug reported: I found an interesting bug in the to_digest handler: when a message is not ascii only but has no encoding defined (which happens in the wild unfortunately), the mailbox will crash when adding the message on line 58 of handlers/to_digest.py. The reason is that due to the mailman-specific email.message.Message modifications, some of the headers are unicode strings. As a consequence, when the mailbox.add code from the standard library serializes the email, it merges unicode strings with bytestrings, which result in an unicode string. If this string contains non-ascii characters, python will raise an UnicodeDecodeError doing so. The solution for that is to call the as_string() method before adding to the mailbox, it will do the serialization properly. I'm attaching the fix (one-liner) and a testcase to reproduce it (much larger). ** Affects: mailman Importance: Undecided Status: New ** Tags: mailman3 ** Patch added: "mailman-digestunicode.patch" https://bugs.launchpad.net/bugs/1170347/+attachment/3647526/+files/mailman-d... -- You received this bug notification because you are a member of Mailman Coders, which is subscribed to GNU Mailman. https://bugs.launchpad.net/bugs/1170347 Title: Digest handler crashes on non-ascii messages with no encoding header To manage notifications about this bug go to: https://bugs.launchpad.net/mailman/+bug/1170347/+subscriptions
Oops there was a typo in my patch, sorry about that. Here's the new one ** Patch added: "mailman-digestunicode.patch" https://bugs.launchpad.net/mailman/+bug/1170347/+attachment/3647541/+files/m... -- You received this bug notification because you are a member of Mailman Coders, which is subscribed to GNU Mailman. https://bugs.launchpad.net/bugs/1170347 Title: Digest handler crashes on non-ascii messages with no encoding header To manage notifications about this bug go to: https://bugs.launchpad.net/mailman/+bug/1170347/+subscriptions
I've pushed the fix in my branch: lp:~abompard/mailman/bug-1170347 (merge proposal sent). -- You received this bug notification because you are a member of Mailman Coders, which is subscribed to GNU Mailman. https://bugs.launchpad.net/bugs/1170347 Title: Digest handler crashes on non-ascii messages with no encoding header To manage notifications about this bug go to: https://bugs.launchpad.net/mailman/+bug/1170347/+subscriptions
** Branch linked: lp:~abompard/mailman/bug-1170347 -- You received this bug notification because you are a member of Mailman Coders, which is subscribed to GNU Mailman. https://bugs.launchpad.net/bugs/1170347 Title: Digest handler crashes on non-ascii messages with no encoding header To manage notifications about this bug go to: https://bugs.launchpad.net/mailman/+bug/1170347/+subscriptions
** Changed in: mailman Milestone: None => 3.0.0b5 ** Changed in: mailman Assignee: (unassigned) => Barry Warsaw (barry) ** Changed in: mailman Importance: Undecided => High -- You received this bug notification because you are a member of Mailman Coders, which is subscribed to GNU Mailman. https://bugs.launchpad.net/bugs/1170347 Title: Digest handler crashes on non-ascii messages with no encoding header To manage notifications about this bug go to: https://bugs.launchpad.net/mailman/+bug/1170347/+subscriptions
** Changed in: mailman Status: New => Fix Committed -- You received this bug notification because you are a member of Mailman Coders, which is subscribed to GNU Mailman. https://bugs.launchpad.net/bugs/1170347 Title: Digest handler crashes on non-ascii messages with no encoding header To manage notifications about this bug go to: https://bugs.launchpad.net/mailman/+bug/1170347/+subscriptions
** Changed in: mailman Status: Fix Committed => Fix Released -- You received this bug notification because you are a member of Mailman Coders, which is subscribed to GNU Mailman. https://bugs.launchpad.net/bugs/1170347 Title: Digest handler crashes on non-ascii messages with no encoding header To manage notifications about this bug go to: https://bugs.launchpad.net/mailman/+bug/1170347/+subscriptions
participants (2)
-
Aurélien Bompard
-
Barry Warsaw