Message297584
Parsing an email containing a multipart Content-Type, along with a Content-Transfer-Encoding containing an invalid (non-ASCII-decodable) byte will fail.
email.feedparser.FeedParser._parsegen() calls "self._cur.get('content-transfer-encoding', '8bit')" to get the header.
It then tries to check whether the C-T-E is in the allowable set of ('7bit', '8bit', 'binary'), and to do so case-insensitively, it tries to convert the header to lowercase. However, because there's an invalid character in there, it's dealing with a Header object rather than a str. Hence it throws an AttributeError.
Correct behaviour would be to convert the Header to a str, see that it's not valid, and continue on to handle the defect as usual.
Thanks to Daniel Axtens for finding this bug as he was running the AFL fuzzer on the email parsing code in Patchwork (https://github.com/getpatchwork/patchwork).
Pull request incoming. |
|
Date |
User |
Action |
Args |
2017-07-03 13:37:03 | Andrew Donnellan | set | recipients:
+ Andrew Donnellan, barry, r.david.murray |
2017-07-03 13:37:03 | Andrew Donnellan | set | messageid: <1499089023.06.0.76757916564.issue30835@psf.upfronthosting.co.za> |
2017-07-03 13:37:02 | Andrew Donnellan | link | issue30835 messages |
2017-07-03 13:37:02 | Andrew Donnellan | create | |
|