From c2b4acf494ab433cff9b97a49f679dbd2fefc3ac Mon Sep 17 00:00:00 2001 From: Neal Norwitz Date: Thu, 20 Oct 2005 04:16:45 +0000 Subject: Backport: SF bug #1331563 ] string_subscript doesn't check for failed PyMem_Malloc. --- Objects/stringobject.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Objects/stringobject.c b/Objects/stringobject.c index b8e5f41..e7b6e69 100644 --- a/Objects/stringobject.c +++ b/Objects/stringobject.c @@ -1184,6 +1184,8 @@ string_subscript(PyStringObject* self, PyObject* item) else { source_buf = PyString_AsString((PyObject*)self); result_buf = PyMem_Malloc(slicelength); + if (result_buf == NULL) + return PyErr_NoMemory(); for (cur = start, i = 0; i < slicelength; cur += step, i++) { -- cgit v0.12