mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Issue #8650: Backport 64-bit safety fixes for compress() and decompress().
This commit is contained in:
parent
7619e88adb
commit
1b8a417d9f
2 changed files with 32 additions and 10 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue