[Python-checkins] python/dist/src/Lib/test test_zlib.py,1.26,1.27

akuchling at users.sourceforge.net akuchling at users.sourceforge.net
Tue Dec 28 21:11:12 CET 2004


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27207/Lib/test

Modified Files:
	test_zlib.py 
Log Message:
[Bug #1083110] calling .flush() on decompress objects causes a segfault due to an uninitialized pointer: fixes the problem and adds a test case

Index: test_zlib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_zlib.py,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- test_zlib.py	5 Jun 2004 19:34:28 -0000	1.26
+++ test_zlib.py	28 Dec 2004 20:10:37 -0000	1.27
@@ -290,6 +290,16 @@
             # 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)."""



More information about the Python-checkins mailing list