From: Barry Warsaw Date: Mon, 10 Mar 2003 16:09:51 +0000 (+0000) Subject: test_broken_base64_payload(): Test for crash in low-level binascii X-Git-Tag: v2.3c1~1501 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3efb651ea3e406b77f3dea752f5e691fa01afac5;p=thirdparty%2FPython%2Fcpython.git test_broken_base64_payload(): Test for crash in low-level binascii module when decoding a message with broken base64. --- diff --git a/Lib/email/test/test_email.py b/Lib/email/test/test_email.py index 549c3d0776a7..1df9b09f1701 100644 --- a/Lib/email/test/test_email.py +++ b/Lib/email/test/test_email.py @@ -458,6 +458,14 @@ class TestMessageAPI(TestEmailBase): eq(msg.values(), ['One Hundred', 'Twenty', 'Three', 'Eleven']) self.assertRaises(KeyError, msg.replace_header, 'Fourth', 'Missing') + def test_broken_base64_payload(self): + x = 'AwDp0P7//y6LwKEAcPa/6Q=9' + msg = Message() + msg['content-type'] = 'audio/x-midi' + msg['content-transfer-encoding'] = 'base64' + msg.set_payload(x) + self.assertEqual(msg.get_payload(decode=True), x) + # Test the email.Encoders module