summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorNadeem Vawda <nadeem.vawda@gmail.com>2011-05-14 20:26:55 (GMT)
committerNadeem Vawda <nadeem.vawda@gmail.com>2011-05-14 20:26:55 (GMT)
commit1b8a417d9ff3b333aa466ecb1806634ca49f1da1 (patch)
tree824b0fd85d8c9582b03d9b6189bfa588070866b2 /Lib
parent7619e88adb27d1cd167483304cd1514812b68039 (diff)
downloadcpython-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.py11
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