]> granicus.if.org Git - python/commitdiff
Fix SF #544995 (zlib crash on second flush call)
authorJeremy Hylton <jeremy@alum.mit.edu>
Fri, 19 Apr 2002 14:37:07 +0000 (14:37 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Fri, 19 Apr 2002 14:37:07 +0000 (14:37 +0000)
Bug fix by mhammond.

Bug fix candidate for 2.2, not present in 2.1.

Lib/test/test_zlib.py
Modules/zlibmodule.c

index 88815160f8b8c0e632c5dcaad2488a60ed68cbbd..35bca88432050a9f62d99c49e8e598c413e16447 100644 (file)
@@ -41,6 +41,12 @@ buf = buf * 16
 co = zlib.compressobj(8, 8, -15)
 x1 = co.compress(buf)
 x2 = co.flush()
+try:
+    co.flush()
+    print "Oops - second flush worked when it should not have!"
+except zlib.error:
+    pass
+
 x = x1 + x2
 
 dc = zlib.decompressobj(-15)
index 8fc3bc20fddb1748aad3aa3d1e2019902f0e3c43..a3891f71336a3e5b549f7137c88c0e3fef5d4b94 100644 (file)
@@ -648,6 +648,7 @@ PyZlib_flush(compobject *self, PyObject *args)
        zlib_error(self->zst, err, "while flushing");
        Py_DECREF(RetVal);
        RetVal = NULL;
+       goto error;
     }
 
     if (_PyString_Resize(&RetVal, self->zst.total_out - start_total_out) < 0)