summaryrefslogtreecommitdiffstats
path: root/Lib/email/_header_value_parser.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-07-17 17:32:31 (GMT)
committerGitHub <noreply@github.com>2019-07-17 17:32:31 (GMT)
commit80f74ce83b6757526ee6927fe89897f3460f25f9 (patch)
treef7e776a0f0ec2a13fddd6287f57f8cc4f722071a /Lib/email/_header_value_parser.py
parent391511ccaaf0050970dfbe95bf2df1bcf6c33440 (diff)
downloadcpython-80f74ce83b6757526ee6927fe89897f3460f25f9.zip
cpython-80f74ce83b6757526ee6927fe89897f3460f25f9.tar.gz
cpython-80f74ce83b6757526ee6927fe89897f3460f25f9.tar.bz2
Fix IndexError when parsing unexpectedly ending quoted-string. (GH-14813)
This exception was caused because the input ended unexpectedly with only one single quote instead of a pair with some value inside it. (cherry picked from commit 719a062bcb7b08a56e6576dcd75f4244e6053209) Co-authored-by: Abhilash Raj <maxking@users.noreply.github.com>
Diffstat (limited to 'Lib/email/_header_value_parser.py')
-rw-r--r--Lib/email/_header_value_parser.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/email/_header_value_parser.py b/Lib/email/_header_value_parser.py
index a342a8e..801ae72 100644
--- a/Lib/email/_header_value_parser.py
+++ b/Lib/email/_header_value_parser.py
@@ -1189,7 +1189,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] != '"':