]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
test_broken_base64_payload(): Test for crash in low-level binascii
authorBarry Warsaw <barry@python.org>
Mon, 10 Mar 2003 16:09:51 +0000 (16:09 +0000)
committerBarry Warsaw <barry@python.org>
Mon, 10 Mar 2003 16:09:51 +0000 (16:09 +0000)
module when decoding a message with broken base64.

Lib/email/test/test_email.py

index 549c3d0776a7ed22efeaa8e08107b29868d1eb3d..1df9b09f1701a1d612a525b47fa386e6b02e5054 100644 (file)
@@ -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)
+
 
 \f
 # Test the email.Encoders module