]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
avoid referencing past the bounds of an array
authorBenjamin Peterson <benjamin@python.org>
Sat, 15 Mar 2014 17:21:28 +0000 (12:21 -0500)
committerBenjamin Peterson <benjamin@python.org>
Sat, 15 Mar 2014 17:21:28 +0000 (12:21 -0500)
Objects/listobject.c

index 5f3e282827930cda623b3b5c81e0f1e79474f1cd..ae365770ea5f8b5f4a0602c782304d6ee0f14fec 100644 (file)
@@ -1963,7 +1963,7 @@ listsort(PyListObject *self, PyObject *args, PyObject *kwds)
             if (keys[i] == NULL) {
                 for (i=i-1 ; i>=0 ; i--)
                     Py_DECREF(keys[i]);
-                if (keys != &ms.temparray[saved_ob_size+1])
+                if (saved_ob_size >= MERGESTATE_TEMP_SIZE/2)
                     PyMem_FREE(keys);
                 goto keyfunc_fail;
             }