[issue37764] email.Message.as_string infinite loop

My Tran report at bugs.python.org
Mon Aug 5 12:23:23 EDT 2019


New submission from My Tran <my at mytran.com>:

The following will hang the system until it runs out of memory. 

import email
import email.policy

text = """From: user at host.com
To: user at host.com
Bad-Header:
 =?us-ascii?Q?LCSwrV11+IB0rSbSker+M9vWR7wEDSuGqmHD89Gt=ea0nJFSaiz4vX3XMJPT4vrE?=
 =?us-ascii?Q?xGUZeOnp0o22pLBB7CYLH74Js=wOlK6Tfru2U47qR?=
 =?us-ascii?Q?72OfyEY2p2=2FrA9xNFyvH+fBTCmazxwzF8nGkK6D?=

Hello!
"""

eml = email.message_from_string(text, policy=email.policy.SMTPUTF8)
eml.as_string()

----------
components: email
messages: 349055
nosy: barry, mytran, r.david.murray
priority: normal
severity: normal
status: open
title: email.Message.as_string infinite loop
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37764>
_______________________________________


More information about the Python-bugs-list mailing list