New submission from Abhilash Raj <raj.abhila...@gmail.com>:
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] != '"': ---------- components: email messages: 347190 nosy: barry, maxking, r.david.murray priority: normal severity: normal status: open title: IndexError in get_bare_quoted_string type: crash versions: Python 3.8, Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue37491> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com