diff options
author | Nadeem Vawda <nadeem.vawda@gmail.com> | 2011-05-14 20:26:55 (GMT) |
---|---|---|
committer | Nadeem Vawda <nadeem.vawda@gmail.com> | 2011-05-14 20:26:55 (GMT) |
commit | 1b8a417d9ff3b333aa466ecb1806634ca49f1da1 (patch) | |
tree | 824b0fd85d8c9582b03d9b6189bfa588070866b2 /Lib | |
parent | 7619e88adb27d1cd167483304cd1514812b68039 (diff) | |
download | cpython-1b8a417d9ff3b333aa466ecb1806634ca49f1da1.zip cpython-1b8a417d9ff3b333aa466ecb1806634ca49f1da1.tar.gz cpython-1b8a417d9ff3b333aa466ecb1806634ca49f1da1.tar.bz2 |
Issue #8650: Backport 64-bit safety fixes for compress() and decompress().
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_zlib.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py index f991900..6bc386ed 100644 --- a/Lib/test/test_zlib.py +++ b/Lib/test/test_zlib.py @@ -186,6 +186,17 @@ class CompressTestCase(BaseCompressTestCase, unittest.TestCase): def test_big_decompress_buffer(self, size): self.check_big_decompress_buffer(size, zlib.decompress) + @precisionbigmemtest(size=_4G + 100, memuse=1) + def test_length_overflow(self, size): + if size < _4G + 100: + self.skipTest("not enough free memory, need at least 4 GB") + data = b'x' * size + try: + self.assertRaises(OverflowError, zlib.compress, data, 1) + self.assertRaises(OverflowError, zlib.decompress, data) + finally: + data = None + class CompressObjectTestCase(BaseCompressTestCase, unittest.TestCase): # Test compression object |