Author maxking
Recipients barry, maxking, r.david.murray
Date 2019-07-03.08:19:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1562141971.16.0.876863205208.issue37491@roundup.psfhosted.org>
In-reply-to
Content
from email.parser import BytesParser, Parser
from email.policy import default

payload = 'Content-Type:x;\x1b*="\'G\'\\"""""'
msg = Parser(policy=default).parsestr(payload)
print(msg.get('content-type'))


When trying to review PR for BPO 37461, I found another bug where an IndexError
is raised if there aren't closing quote characters in the input message:

Suggested patch:

@@ -1191,7 +1192,7 @@ def get_bare_quoted_string(value):
             "expected '\"' but found '{}'".format(value))
     bare_quoted_string = BareQuotedString()
     value = value[1:]
-    if value[0] == '"':
+    if value and value[0] == '"':
         token, value = get_qcontent(value)
         bare_quoted_string.append(token)
     while value and value[0] != '"':
History
Date User Action Args
2019-07-03 08:19:31maxkingsetrecipients: + maxking, barry, r.david.murray
2019-07-03 08:19:31maxkingsetmessageid: <1562141971.16.0.876863205208.issue37491@roundup.psfhosted.org>
2019-07-03 08:19:31maxkinglinkissue37491 messages
2019-07-03 08:19:30maxkingcreate