[Python-checkins] cpython (merge 3.4 -> default): merge 3.4 (#24044)

benjamin.peterson python-checkins at python.org
Thu Apr 23 23:08:06 CEST 2015


https://hg.python.org/cpython/rev/bd656916586f
changeset:   95789:bd656916586f
parent:      95785:d1b706e57fbe
parent:      95788:80485b8e43cd
user:        Benjamin Peterson <benjamin at python.org>
date:        Thu Apr 23 17:06:45 2015 -0400
summary:
  merge 3.4 (#24044)

files:
  Misc/NEWS            |  3 +++
  Objects/listobject.c |  6 ++++--
  2 files changed, 7 insertions(+), 2 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -78,6 +78,9 @@
 - Issue #23466: %c, %o, %x, and %X in bytes formatting now raise TypeError on
   non-integer input.
 
+- Issue #24044: Fix possible null pointer dereference in list.sort in out of
+  memory conditions.
+
 Library
 -------
 
diff --git a/Objects/listobject.c b/Objects/listobject.c
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -1961,8 +1961,10 @@
             keys = &ms.temparray[saved_ob_size+1];
         else {
             keys = PyMem_MALLOC(sizeof(PyObject *) * saved_ob_size);
-            if (keys == NULL)
-                return NULL;
+            if (keys == NULL) {
+                PyErr_NoMemory();
+                goto keyfunc_fail;
+            }
         }
 
         for (i = 0; i < saved_ob_size ; i++) {

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list