This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients barry, r.david.murray, rad164, vstinner, xtreak
Date 2019-06-17.16:22:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1560788522.22.0.206882053688.issue33529@roundup.psfhosted.org>
In-reply-to
Content
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?=
History
Date User Action Args
2019-06-17 16:22:02vstinnersetrecipients: + vstinner, barry, r.david.murray, rad164, xtreak
2019-06-17 16:22:02vstinnersetmessageid: <1560788522.22.0.206882053688.issue33529@roundup.psfhosted.org>
2019-06-17 16:22:02vstinnerlinkissue33529 messages
2019-06-17 16:22:02vstinnercreate