cpython/Lib/test/test_email
Miss Islington (bot) e9970f0772
[3.11] gh-143935: Email preserve parens when folding comments (GH-143936) (#144037)
gh-143935: Email preserve parens when folding comments (GH-143936)

Fix a bug in the folding of comments when flattening an email message
using a modern email policy. Comments consisting of a very long sequence of
non-foldable characters could trigger a forced line wrap that omitted the
required leading space on the continuation line, causing the remainder of
the comment to be interpreted as a new header field. This enabled header
injection with carefully crafted inputs.
(cherry picked from commit 17d1490aa9)

Co-authored-by: Seth Michael Larson <seth@python.org>
Co-authored-by: Denis Ledoux <dle@odoo.com>
2026-01-25 17:10:38 +00:00
..
data [3.11] gh-106186: Don't report MultipartInvariantViolationDefect for valid multipart emails when parsing header only (GH-107016) (#107112) 2023-07-23 14:28:35 +02:00
__init__.py bpo-43651: PEP 597: Fix test_email (GH-25158) 2021-04-05 12:30:12 +09:00
__main__.py
test__encoded_words.py bpo-43323: Fix UnicodeEncodeError in the email module (GH-32137) 2022-04-30 13:17:23 +03:00
test__header_value_parser.py [3.11] gh-143935: Email preserve parens when folding comments (GH-143936) (#144037) 2026-01-25 17:10:38 +00:00
test_asian_codecs.py
test_contentmanager.py bpo-41402: Fix email ContentManager calling .encode() on bytes (GH-21631) 2021-08-09 18:45:41 +02:00
test_defect_handling.py bpo-27397: Make email module properly handle invalid-length base64 strings (#7583) 2018-06-12 15:46:22 +03:00
test_email.py [3.11] gh-136063: fix quadratic-complexity parsing in email.message._parseparam (GH-136072) (GH-140830) 2025-10-31 18:29:53 +01:00
test_generator.py [3.11] gh-144125: email: verify headers are sound in BytesGenerator (#144189) 2026-01-25 17:09:56 +00:00
test_headerregistry.py bpo-43323: Fix UnicodeEncodeError in the email module (GH-32137) 2022-04-30 13:17:23 +03:00
test_inversion.py bpo-30681: Support invalid date format or value in email Date header (GH-22090) 2020-10-26 17:31:06 -07:00
test_message.py [3.11] gh-94606: Fix error when message with Unicode surrogate not surrogateescaped string (GH-94641) (GH-112972) 2023-12-11 16:47:25 +00:00
test_parser.py #20476: add a message_factory policy attribute to email. 2016-09-09 18:39:18 -04:00
test_pickleable.py
test_policy.py [3.11] gh-144125: email: verify headers are sound in BytesGenerator (#144189) 2026-01-25 17:09:56 +00:00
test_utils.py [3.11] gh-113027: Fix test_variable_tzname in test_email (GH-113821) (GH-113832) 2024-01-12 11:59:23 +00:00
torture_test.py bpo-5846: Do not use obsolete unittest functions. (GH-28303) 2021-09-13 10:49:53 +03:00