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

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


https://hg.python.org/cpython/rev/0d8f15053f42
changeset:   95787:0d8f15053f42
branch:      3.3
parent:      95717:7d7bf5c34d7e
parent:      95786:91096d27c802
user:        Benjamin Peterson <benjamin at python.org>
date:        Thu Apr 23 17:05:07 2015 -0400
summary:
  merge 3.2 (#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
@@ -10,6 +10,9 @@
 Core and Builtins
 -----------------
 
+- Issue #24044: Fix possible null pointer dereference in list.sort in out of
+  memory conditions.
+
 - Issue #23055: Fixed a buffer overflow in PyUnicode_FromFormatV.  Analysis
   and fix by Guido Vranken.
 
diff --git a/Objects/listobject.c b/Objects/listobject.c
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -1953,8 +1953,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