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

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


https://hg.python.org/cpython/rev/80485b8e43cd
changeset:   95788:80485b8e43cd
branch:      3.4
parent:      95784:0f9c43fb189d
parent:      95787:0d8f15053f42
user:        Benjamin Peterson <benjamin at python.org>
date:        Thu Apr 23 17:06:33 2015 -0400
summary:
  merge 3.3 (#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
@@ -28,6 +28,9 @@
 - Issue #23629: Fix the default __sizeof__ implementation for variable-sized
   objects.
 
+- 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