mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
[3.9] bpo-41735: Fix thread lock in zlib.Decompress.flush() may go wrong (GH-29588)
* Fix thread lock in zlib.Decompress.flush() may go wrong Getting `.unconsumed_tail` before acquiring the thread lock may mix up decompress state. backport of https://github.com/python/cpython/pull/29587 to 3.9/3.8.
This commit is contained in:
parent
133fb267f4
commit
86c1265cdc
2 changed files with 6 additions and 3 deletions
|
@ -1134,11 +1134,13 @@ zlib_Decompress_flush_impl(compobject *self, Py_ssize_t length)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (PyObject_GetBuffer(self->unconsumed_tail, &data, PyBUF_SIMPLE) == -1)
|
||||
return NULL;
|
||||
|
||||
ENTER_ZLIB(self);
|
||||
|
||||
if (PyObject_GetBuffer(self->unconsumed_tail, &data, PyBUF_SIMPLE) == -1) {
|
||||
LEAVE_ZLIB(self);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
self->zst.next_in = data.buf;
|
||||
ibuflen = data.len;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue