]> granicus.if.org Git - python/commit
[3.8] bpo-37764: Fix infinite loop when parsing unstructured email headers. (GH-15239...
authorAbhilash Raj <maxking@users.noreply.github.com>
Thu, 5 Sep 2019 01:20:40 +0000 (18:20 -0700)
committerGitHub <noreply@github.com>
Thu, 5 Sep 2019 01:20:40 +0000 (18:20 -0700)
commit6ad0a2c45f78020f7994e47620c1cf7b225f8197
treeb91b5ff415501be4d1cef947424d15e00b0f2ffe
parent6d7a786d2e4b48a6b50614e042ace9ff996f0238
[3.8] bpo-37764: Fix infinite loop when parsing unstructured email headers. (GH-15239) (GH-15686)

Fixes a case in which email._header_value_parser.get_unstructured hangs the system for some invalid headers. This covers the cases in which the header contains either:
- a case without trailing whitespace
- an invalid encoded word

https://bugs.python.org/issue37764

This fix should also be backported to 3.7 and 3.8

https://bugs.python.org/issue37764
(cherry picked from commit c5b242f87f31286ad38991bc3868cf4cfbf2b681)

Co-authored-by: Ashwin Ramaswami <aramaswamis@gmail.com>
Lib/email/_header_value_parser.py
Lib/test/test_email/test__header_value_parser.py
Lib/test/test_email/test_email.py
Misc/ACKS
Misc/NEWS.d/next/Security/2019-08-27-01-13-05.bpo-37764.qv67PQ.rst [new file with mode: 0644]