From 749073af13fcb389059b182290f5cbc953222681 Mon Sep 17 00:00:00 2001 From: R David Murray Date: Wed, 22 Jun 2011 13:47:53 -0400 Subject: #1874: detect invalid multipart CTE and report it as a defect. --- Lib/email/feedparser.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Lib/email/feedparser.py') diff --git a/Lib/email/feedparser.py b/Lib/email/feedparser.py index 60de49e97f..e754d89cb6 100644 --- a/Lib/email/feedparser.py +++ b/Lib/email/feedparser.py @@ -300,6 +300,11 @@ class FeedParser: lines.append(line) self._cur.set_payload(EMPTYSTRING.join(lines)) return + # Make sure a valid content type was specified per RFC 2045:6.4. + if (self._cur.get('content-transfer-encoding', '8bit').lower() + not in ('7bit', '8bit', 'binary')): + defect = errors.InvalidMultipartContentTransferEncodingDefect() + self.policy.handle_defect(self._cur, defect) # Create a line match predicate which matches the inter-part # boundary as well as the end-of-multipart boundary. Don't push # this onto the input stream until we've scanned past the -- cgit v1.2.1