mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Fix SF #544995 (zlib crash on second flush call)
Bug fix by mhammond. Bug fix candidate for 2.2, not present in 2.1.
This commit is contained in:
parent
a6aa71deec
commit
c72737e7b6
2 changed files with 7 additions and 0 deletions
|
@ -41,6 +41,12 @@ buf = buf * 16
|
||||||
co = zlib.compressobj(8, 8, -15)
|
co = zlib.compressobj(8, 8, -15)
|
||||||
x1 = co.compress(buf)
|
x1 = co.compress(buf)
|
||||||
x2 = co.flush()
|
x2 = co.flush()
|
||||||
|
try:
|
||||||
|
co.flush()
|
||||||
|
print "Oops - second flush worked when it should not have!"
|
||||||
|
except zlib.error:
|
||||||
|
pass
|
||||||
|
|
||||||
x = x1 + x2
|
x = x1 + x2
|
||||||
|
|
||||||
dc = zlib.decompressobj(-15)
|
dc = zlib.decompressobj(-15)
|
||||||
|
|
|
@ -648,6 +648,7 @@ PyZlib_flush(compobject *self, PyObject *args)
|
||||||
zlib_error(self->zst, err, "while flushing");
|
zlib_error(self->zst, err, "while flushing");
|
||||||
Py_DECREF(RetVal);
|
Py_DECREF(RetVal);
|
||||||
RetVal = NULL;
|
RetVal = NULL;
|
||||||
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_PyString_Resize(&RetVal, self->zst.total_out - start_total_out) < 0)
|
if (_PyString_Resize(&RetVal, self->zst.total_out - start_total_out) < 0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue