summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_email/test__header_value_parser.py
diff options
context:
space:
mode:
authorAbhilash Raj <maxking@users.noreply.github.com>2019-07-17 16:48:52 (GMT)
committerBarry Warsaw <barry@python.org>2019-07-17 16:48:52 (GMT)
commit719a062bcb7b08a56e6576dcd75f4244e6053209 (patch)
treef0a504456d20cbda6b1cc888e158e50652e7cde4 /Lib/test/test_email/test__header_value_parser.py
parenta4a994bd3e619cbaff97610a1cee8ffa87c672f5 (diff)
downloadcpython-719a062bcb7b08a56e6576dcd75f4244e6053209.zip
cpython-719a062bcb7b08a56e6576dcd75f4244e6053209.tar.gz
cpython-719a062bcb7b08a56e6576dcd75f4244e6053209.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.
Diffstat (limited to 'Lib/test/test_email/test__header_value_parser.py')
-rw-r--r--Lib/test/test_email/test__header_value_parser.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_email/test__header_value_parser.py b/Lib/test/test_email/test__header_value_parser.py
index a83915d..4fa56b1 100644
--- a/Lib/test/test_email/test__header_value_parser.py
+++ b/Lib/test/test_email/test__header_value_parser.py
@@ -522,6 +522,10 @@ class TestParser(TestParserMixin, TestEmailBase):
self._test_get_x(parser.get_bare_quoted_string,
'""', '""', '', [], '')
+ def test_get_bare_quoted_string_missing_endquotes(self):
+ self._test_get_x(parser.get_bare_quoted_string,
+ '"', '""', '', [errors.InvalidHeaderDefect], '')
+
def test_get_bare_quoted_string_following_wsp_preserved(self):
self._test_get_x(parser.get_bare_quoted_string,
'"foo"\t bar', '"foo"', 'foo', [], '\t bar')