]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-74678: Increase base64 test coverage (GH-21913) (GH-113810)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 8 Jan 2024 11:16:06 +0000 (12:16 +0100)
committerGitHub <noreply@github.com>
Mon, 8 Jan 2024 11:16:06 +0000 (11:16 +0000)
Ensure the character y is disallowed within an Ascii85 5-tuple.

(cherry picked from commit 802d4954f12541ba28dd7f18bf4a65054941a80d)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Co-authored-by: Lee Cannon <leecannon@leecannon.xyz>
Lib/test/test_base64.py

index 217f2945468844e2423876a7e199cd0d9d34ac14..8582cdc409371c9a1820aeca4d81ce27ec3720dc 100644 (file)
@@ -582,6 +582,7 @@ class BaseXYTestCase(unittest.TestCase):
         eq(base64.a85decode(b'y+<Vd', foldspaces=True, adobe=False), b' '*7)
         eq(base64.a85decode(b'y+<U', foldspaces=True, adobe=False), b' '*6)
         eq(base64.a85decode(b'y+9', foldspaces=True, adobe=False), b' '*5)
+        eq(base64.a85decode(b'aaaaay', foldspaces=True), b'\xc9\x80\x0b@    ')
 
         self.check_other_types(base64.a85decode, b'GB\\6`E-ZP=Df.1GEb>',
                                b"www.python.org")
@@ -685,6 +686,8 @@ class BaseXYTestCase(unittest.TestCase):
         self.assertRaises(ValueError, base64.a85decode, b's8W', adobe=False)
         self.assertRaises(ValueError, base64.a85decode, b's8W-', adobe=False)
         self.assertRaises(ValueError, base64.a85decode, b's8W-"', adobe=False)
+        self.assertRaises(ValueError, base64.a85decode, b'aaaay',
+                          foldspaces=True)
 
     def test_b85decode_errors(self):
         illegal = list(range(33)) + \