summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2003-03-10 16:09:51 (GMT)
committerBarry Warsaw <barry@python.org>2003-03-10 16:09:51 (GMT)
commit3efb651ea3e406b77f3dea752f5e691fa01afac5 (patch)
tree9978cb13b1f90f631d44abe1ed06d99d48444728 /Lib
parenta57dccdcd473f3c8187e68348ebcd71c904be9e3 (diff)
downloadcpython-3efb651ea3e406b77f3dea752f5e691fa01afac5.zip
cpython-3efb651ea3e406b77f3dea752f5e691fa01afac5.tar.gz
cpython-3efb651ea3e406b77f3dea752f5e691fa01afac5.tar.bz2
test_broken_base64_payload(): Test for crash in low-level binascii
module when decoding a message with broken base64.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/email/test/test_email.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/email/test/test_email.py b/Lib/email/test/test_email.py
index 549c3d0..1df9b09 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