cpython/Lib/test/test_email
Abhilash Raj aa79707262 bpo-30835: email: Fix AttributeError when parsing invalid CTE (GH-13598)
* bpo-30835: email: Fix AttributeError when parsing invalid Content-Transfer-Encoding

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() gets the header and
attempts to convert it to lowercase before comparing it with the accepted
encodings, but as the header contains an invalid byte, it's returned as a
Header object rather than a str.

Cast the Content-Transfer-Encoding header to a str to avoid this.

Found using the AFL fuzzer.

Reported-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Andrew Donnellan <andrew@donnellan.id.au>

* Add email and NEWS entry for the bugfix.
2019-06-04 11:00:47 -07:00
..
data
__init__.py
__main__.py
test__encoded_words.py
test__header_value_parser.py bpo-35805: Add parser for Message-ID email header. (GH-13397) 2019-06-04 10:41:34 -07:00
test_asian_codecs.py
test_contentmanager.py
test_defect_handling.py
test_email.py bpo-30835: email: Fix AttributeError when parsing invalid CTE (GH-13598) 2019-06-04 11:00:47 -07:00
test_generator.py
test_headerregistry.py bpo-35805: Add parser for Message-ID email header. (GH-13397) 2019-06-04 10:41:34 -07:00
test_inversion.py
test_message.py
test_parser.py
test_pickleable.py
test_policy.py bpo-33524: Fix the folding of email header when max_line_length is 0 or None (#13391) 2019-05-17 15:28:44 -04:00
test_utils.py
torture_test.py