[Python-checkins] cpython (3.2): properly handle malloc failure (closes #24044)
benjamin.peterson
python-checkins at python.org
Thu Apr 23 23:08:06 CEST 2015
https://hg.python.org/cpython/rev/91096d27c802
changeset: 95786:91096d27c802
branch: 3.2
parent: 94677:29316b605ae4
user: Benjamin Peterson <benjamin at python.org>
date: Thu Apr 23 17:04:36 2015 -0400
summary:
properly handle malloc failure (closes #24044)
Patch by Christian Heimes.
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
@@ -1924,8 +1924,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