From: Jeremy Hylton Date: Fri, 19 Apr 2002 14:37:07 +0000 (+0000) Subject: Fix SF #544995 (zlib crash on second flush call) X-Git-Tag: v2.3c1~5881 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c72737e7b6ec3beeecafbef75fbc31e22e0d710b;p=python Fix SF #544995 (zlib crash on second flush call) Bug fix by mhammond. Bug fix candidate for 2.2, not present in 2.1. --- diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py index 88815160f8..35bca88432 100644 --- a/Lib/test/test_zlib.py +++ b/Lib/test/test_zlib.py @@ -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) diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c index 8fc3bc20fd..a3891f7133 100644 --- a/Modules/zlibmodule.c +++ b/Modules/zlibmodule.c @@ -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)