diff options
author | Andrew M. Kuchling <amk@amk.ca> | 2004-12-28 20:10:48 (GMT) |
---|---|---|
committer | Andrew M. Kuchling <amk@amk.ca> | 2004-12-28 20:10:48 (GMT) |
commit | 3b585b30c04489f869098e5769105c7319d211c1 (patch) | |
tree | 1f668245d7b27349054c38a8d052841f8df98b37 /Lib/test/test_zlib.py | |
parent | 078824e4f67a770d8a92d547e6a52d45843f900c (diff) | |
download | cpython-3b585b30c04489f869098e5769105c7319d211c1.zip cpython-3b585b30c04489f869098e5769105c7319d211c1.tar.gz cpython-3b585b30c04489f869098e5769105c7319d211c1.tar.bz2 |
[Bug #1083110] calling .flush() on decompress objects causes a segfault due to an uninitialized pointer: fixes the problem and adds a test case
Diffstat (limited to 'Lib/test/test_zlib.py')
-rw-r--r-- | Lib/test/test_zlib.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py index 8683879..b4bf77e 100644 --- a/Lib/test/test_zlib.py +++ b/Lib/test/test_zlib.py @@ -290,6 +290,16 @@ class CompressObjectTestCase(unittest.TestCase): # if decompressed data is different from the input data, choke. self.assertEqual(expanded, data, "17K random source doesn't match") + def test_empty_flush(self): + # Test that calling .flush() on unused objects works. + # (Bug #1083110 -- calling .flush() on decompress objects + # caused a core dump.) + + co = zlib.compressobj(zlib.Z_BEST_COMPRESSION) + self.failUnless(co.flush()) # Returns a zlib header + dco = zlib.decompressobj() + self.assertEqual(dco.flush(), "") # Returns nothing + def genblock(seed, length, step=1024, generator=random): """length-byte stream of random data from a seed (in step-byte blocks).""" |