]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.14] gh-142006: Fix HeaderWriteError in email.policy.default caused by extra newlin...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sat, 6 Dec 2025 21:39:47 +0000 (22:39 +0100)
committerGitHub <noreply@github.com>
Sat, 6 Dec 2025 21:39:47 +0000 (16:39 -0500)
commitb188ebeca0710a243571e95e650d6a910c26795e
treeef821d0a718fb4694ed58042ce7f33852f4e9553
parent1dfe219fec324611c3fe6282fd8628e94d940ada
[3.14] gh-142006: Fix HeaderWriteError in email.policy.default caused by extra newline (GH-142008) (#142361)

gh-142006: Fix HeaderWriteError in email.policy.default caused by extra newline (GH-142008)

RDM: This fixes a subtle folding error that showed up when a token exactly filled a line and was followed by whitespace and a token with no folding whitespace that was longer than a line.  In this particular circumstance the whitespace after the first token got pushed on to the next line, and then stolen to go in front of the next unfoldable token...leaving a completely empty line in the line buffer.  That line got turned in to a newline, which is RFC illegal, and the newish security check caught it.  The fix is to just delete that empty line from the buffer.
(cherry picked from commit 07eff899d8a8ee4c4b1be7cb223fe25687f6216c)

Co-authored-by: Paresh Joshi <rahulj9223@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Lib/email/_header_value_parser.py
Lib/test/test_email/test__header_value_parser.py
Misc/NEWS.d/next/Library/2025-11-27-10-49-13.gh-issue-142006.nzJDG5.rst [new file with mode: 0644]