diff options
author | Gregory P. Smith <greg@mad-scientist.com> | 2008-04-09 00:26:44 +0000 |
---|---|---|
committer | Gregory P. Smith <greg@mad-scientist.com> | 2008-04-09 00:26:44 +0000 |
commit | b72e0d969ec2ecb6417bcc31194631d24c201dc2 (patch) | |
tree | e79ba4e3788f2d9f5ea981b2d68c2bf781536a38 /Modules | |
parent | 9bc3b481c437f766d30ec5310be9a37897b9d8eb (diff) | |
download | cpython-b72e0d969ec2ecb6417bcc31194631d24c201dc2.tar.gz |
Merge r62235 from trunk.
Fix zlib crash from zlib.decompressobj().flush(val) when val was not positive.
It tried to allocate negative or zero memory. That fails.
Diffstat (limited to 'Modules')
-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 8cadcbc52c..aff165c361 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; |