diff options
Diffstat (limited to 'Modules/zlibmodule.c')
-rw-r--r-- | Modules/zlibmodule.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c index f59343f..4f78dbc 100644 --- a/Modules/zlibmodule.c +++ b/Modules/zlibmodule.c @@ -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; |