-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
Open
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-emailtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or errortype-securityA security issueA security issue
Description
Bug report
Bug description:
Tested with 3.6 and 3.13.1
>>> import email.message
>>> message = email.message.EmailMessage()
...
>>> message.add_attachment('Hello World!', filename='hello.txt', params={130 * 'A': 'too long parameter name'})
None
>>> message.defects
[]
>>> message
<email.message.EmailMessage object at 0x7fe78ec74ec0>
>>> message.as_string()
130 characters for a media type parameter name is (a bit) more than https://datatracker.ietf.org/doc/html/rfc6838#section-4.3 allows but I didn't expect it to lead into an infinite loop. I wanted to check if the email module would catch that defect, which apparently it doesn't.
Distribution is openSUSE Leap 15.6, python 3.13.1 was installed from pyenv, 3.6 is from the distribution. The python3.11 binary from the distribution exhibits the same behaviour.
CPython versions tested on:
3.13
Operating systems tested on:
Linux
Linked PRs
- [3.13] gh-138223: Fix Infinite loop in email._header_value_parser._fold_mime_parameters when parameter names are too long #138226
- [3.13] gh-138223: Fix Infinite loop in email._header_value_parser._fold_mime_parameters when parameter names are too long (GH-138223) #138227
- gh-138223: Fix Infinite loop in email._header_value_parser._fold_mime_parameters when parameter names are too long #138231
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-emailtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or errortype-securityA security issueA security issue