mirror of
https://github.com/python/cpython.git
synced 2024-11-28 04:15:11 +08:00
bpo-41735: Fix thread lock in zlib.Decompress.flush() may go wrong (GH-29587)
* Fix thread lock in zlib.Decompress.flush() may go wrong Getting `.unconsumed_tail` before acquiring the thread lock may mix up decompress state.
This commit is contained in:
parent
4841e694ee
commit
7edb6270a7
@ -0,0 +1 @@
|
||||
Fix thread lock in ``zlib.Decompress.flush()`` method before ``PyObject_GetBuffer``.
|
@ -1269,12 +1269,13 @@ zlib_Decompress_flush_impl(compobject *self, PyTypeObject *cls,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ENTER_ZLIB(self);
|
||||
|
||||
if (PyObject_GetBuffer(self->unconsumed_tail, &data, PyBUF_SIMPLE) == -1) {
|
||||
LEAVE_ZLIB(self);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ENTER_ZLIB(self);
|
||||
|
||||
self->zst.next_in = data.buf;
|
||||
ibuflen = data.len;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user