diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2012-05-01 06:38:01 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2012-05-01 06:38:01 (GMT) |
commit | b3260f08cf9066367f63dccbac60798d555e52b9 (patch) | |
tree | f881c9997a44593b2bbea29f9ccae7d3cb8b1da7 /Lib/test/test_zipfile.py | |
parent | f6b16a4b507723b1a22e6cc5af80150f189b3e9d (diff) | |
download | cpython-b3260f08cf9066367f63dccbac60798d555e52b9.zip cpython-b3260f08cf9066367f63dccbac60798d555e52b9.tar.gz cpython-b3260f08cf9066367f63dccbac60798d555e52b9.tar.bz2 |
Detect unsupported compression types.
Diffstat (limited to 'Lib/test/test_zipfile.py')
-rw-r--r-- | Lib/test/test_zipfile.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py index c6039cc..dcf8f74 100644 --- a/Lib/test/test_zipfile.py +++ b/Lib/test/test_zipfile.py @@ -992,6 +992,17 @@ class OtherTests(unittest.TestCase): caught.""" self.assertRaises(RuntimeError, zipfile.ZipFile, TESTFN, "w", -1) + def test_unsupported_compression(self): + # data is declared as shrunk, but actually deflated + data = (b'PK\x03\x04.\x00\x00\x00\x01\x00\xe4C\xa1@\x00\x00\x00' + b'\x00\x02\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00x\x03\x00PK\x01' + b'\x02.\x03.\x00\x00\x00\x01\x00\xe4C\xa1@\x00\x00\x00\x00\x02\x00\x00' + b'\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' + b'\x80\x01\x00\x00\x00\x00xPK\x05\x06\x00\x00\x00\x00\x01\x00\x01\x00' + b'/\x00\x00\x00!\x00\x00\x00\x00\x00') + with zipfile.ZipFile(io.BytesIO(data), 'r') as zipf: + self.assertRaises(NotImplementedError, zipf.open, 'x') + def test_null_byte_in_filename(self): """Check that a filename containing a null byte is properly terminated.""" |