mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
Fix zlib crash from zlib.decompressobj().flush(val) when val was not positive.
It tried to allocate negative or zero memory. That fails.
This commit is contained in:
parent
e41b0061dd
commit
79e42a0e08
2 changed files with 9 additions and 0 deletions
|
|
@ -774,6 +774,10 @@ PyZlib_unflush(compobject *self, PyObject *args)
|
|||
|
||||
if (!PyArg_ParseTuple(args, "|i:flush", &length))
|
||||
return NULL;
|
||||
if (length <= 0) {
|
||||
PyErr_SetString(PyExc_ValueError, "length must be greater than zero");
|
||||
return NULL;
|
||||
}
|
||||
if (!(retval = PyString_FromStringAndSize(NULL, length)))
|
||||
return NULL;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue