mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
bpo-38708: email: Fix a potential IndexError when parsing Message-ID (GH-17504)
Fix a potential IndexError when passing an empty value to the message-id parser. Instead, HeaderParseError should be raised.
This commit is contained in:
parent
68157da8b4
commit
3ae4ea1931
3 changed files with 8 additions and 1 deletions
|
@ -2583,6 +2583,11 @@ class TestParser(TestParserMixin, TestEmailBase):
|
|||
|
||||
# get_msg_id
|
||||
|
||||
def test_get_msg_id_empty(self):
|
||||
# bpo-38708: Test that HeaderParseError is raised and not IndexError.
|
||||
with self.assertRaises(errors.HeaderParseError):
|
||||
parser.get_msg_id('')
|
||||
|
||||
def test_get_msg_id_valid(self):
|
||||
msg_id = self._test_get_x(
|
||||
parser.get_msg_id,
|
||||
|
@ -2694,6 +2699,7 @@ class TestParser(TestParserMixin, TestEmailBase):
|
|||
self.assertEqual(msg_id.token_type, 'msg-id')
|
||||
|
||||
|
||||
|
||||
@parameterize
|
||||
class Test_parse_mime_parameters(TestParserMixin, TestEmailBase):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue