summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_zlib.py
diff options
context:
space:
mode:
authorGregory P. Smith <greg@mad-scientist.com>2008-04-09 00:25:17 (GMT)
committerGregory P. Smith <greg@mad-scientist.com>2008-04-09 00:25:17 (GMT)
commit79e42a0e0817b9c9fc23b333524427662b33986d (patch)
tree5e61bf69ea3291250f08e8616665d941345057d4 /Lib/test/test_zlib.py
parente41b0061dd908251a393f77b030c9e7308ecd5c5 (diff)
downloadcpython-79e42a0e0817b9c9fc23b333524427662b33986d.zip
cpython-79e42a0e0817b9c9fc23b333524427662b33986d.tar.gz
cpython-79e42a0e0817b9c9fc23b333524427662b33986d.tar.bz2
Fix zlib crash from zlib.decompressobj().flush(val) when val was not positive.
It tried to allocate negative or zero memory. That fails.
Diffstat (limited to 'Lib/test/test_zlib.py')
-rw-r--r--Lib/test/test_zlib.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py
index 0c96842..adb87ff 100644
--- a/Lib/test/test_zlib.py
+++ b/Lib/test/test_zlib.py
@@ -83,6 +83,11 @@ class ExceptionTestCase(unittest.TestCase):
# verify failure on building decompress object with bad params
self.assertRaises(ValueError, zlib.decompressobj, 0)
+ def test_decompressobj_badflush(self):
+ # verify failure on calling decompressobj.flush with bad params
+ self.assertRaises(ValueError, zlib.decompressobj().flush, 0)
+ self.assertRaises(ValueError, zlib.decompressobj().flush, -1)
+
class CompressTestCase(unittest.TestCase):