]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
- Issue #2586: Fix CVE-2008-1721, zlib crash from
authorMatthias Klose <doko@ubuntu.com>
Wed, 12 Nov 2008 07:02:24 +0000 (07:02 +0000)
committerMatthias Klose <doko@ubuntu.com>
Wed, 12 Nov 2008 07:02:24 +0000 (07:02 +0000)
  zlib.decompressobj().flush(val) when val is not positive.

Misc/NEWS
Modules/zlibmodule.c

index 38de32730e403997cbdcde355ed99b581c3f2b90..bf3f7462eb1f743da029915e71553bd58d307f7d 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -24,6 +24,9 @@ Core and builtins
 - Issue #1179: Fix CVE-2007-4965 and CVE-2008-1679, multiple integer
   overflows in the imageop and rgbimgmodule modules.
 
+- Issue #2586: Fix CVE-2008-1721, zlib crash from
+  zlib.decompressobj().flush(val) when val is not positive.
+
 Extension Modules
 -----------------
 
index 35b8c32fa4420f771e6c32fca47dcbf5536ceefe..60b3eea55f24d6485fe1a25547595d1a93ced3a8 100644 (file)
@@ -669,6 +669,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;