STINNER Victor <[email protected]> added the comment:
It's unclear to me if Python 3.5 is affected or not.
The fix changes the function _fold_as_ew(), Python 3.5 doesn't have this
function *but* there is a call a _fold_as_ew() method!?
Lib/email/_header_value_parser.py:427: in _fold() method
...
if is_ew or last_ew:
# It's too big to fit on the line, but since we've
# got encoded words we can use encoded word folding.
part._fold_as_ew(folded)
continue
...
If I backport the 2 tests, they fail *but* they don't hang forever (they
complete in less than 1 second).
======================================================================
FAIL: test_fold_overlong_words_using_RFC2047
(test.test_email.test_headerregistry.TestFolding)
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/vstinner/prog/python/3.5/Lib/test/test_email/test_headerregistry.py",
line 1601, in test_fold_overlong_words_using_RFC2047
'X-Report-Abuse: =?utf-8?q?=3Chttps=3A//www=2Emailitapp=2E'
AssertionError: 'X-Report-Abuse: <https://www.mailitapp.com/report_abuse.p[50
chars]x>\n' != 'X-Report-Abuse: =?utf-8?q?=3Chttps=3A//www=2Emailitapp=2E[114
chars]?=\n'
- X-Report-Abuse:
<https://www.mailitapp.com/report_abuse.php?mid=xxx-xxx-xxxxxxxxxxxxxxxxxxxxxxxx==-xxx-xx-xx>
+ X-Report-Abuse: =?utf-8?q?=3Chttps=3A//www=2Emailitapp=2Ecom/report=5Fabuse?=
+ =?utf-8?q?=2Ephp=3Fmid=3Dxxx-xxx-xxxxxxxxxxxxxxxxxxxxxxxx=3D=3D-xxx-xx-xx?=
+ =?utf-8?q?=3E?=
======================================================================
FAIL: test_non_ascii_chars_do_not_cause_inf_loop
(test.test_email.test_policy.PolicyAPITests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/vstinner/prog/python/3.5/Lib/test/test_email/test_policy.py",
line 241, in test_non_ascii_chars_do_not_cause_inf_loop
12 * ' =?utf-8?q?=C4=85?=\n')
AssertionError: 'Subject: =?utf-8?b?xIXEhcSFxIXEhcSFxIXEhcSFxIXEhcSF?=\n' !=
'Subject: \n =?utf-8?q?=C4=85?=\n =?utf-8?q?=C4=85?[209 chars]?=\n'
- Subject: =?utf-8?b?xIXEhcSFxIXEhcSFxIXEhcSFxIXEhcSF?=
+ Subject:
+ =?utf-8?q?=C4=85?=
+ =?utf-8?q?=C4=85?=
+ =?utf-8?q?=C4=85?=
+ =?utf-8?q?=C4=85?=
+ =?utf-8?q?=C4=85?=
+ =?utf-8?q?=C4=85?=
+ =?utf-8?q?=C4=85?=
+ =?utf-8?q?=C4=85?=
+ =?utf-8?q?=C4=85?=
+ =?utf-8?q?=C4=85?=
+ =?utf-8?q?=C4=85?=
+ =?utf-8?q?=C4=85?=
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue33529>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com