diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2005-10-20 04:16:45 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2005-10-20 04:16:45 (GMT) |
commit | c2b4acf494ab433cff9b97a49f679dbd2fefc3ac (patch) | |
tree | 96a2b92e194a98277512ca0363b376820fbc639e /Objects | |
parent | ad2fa76ffa25cac1e7ddea05f23d9a8c4b222de4 (diff) | |
download | cpython-c2b4acf494ab433cff9b97a49f679dbd2fefc3ac.zip cpython-c2b4acf494ab433cff9b97a49f679dbd2fefc3ac.tar.gz cpython-c2b4acf494ab433cff9b97a49f679dbd2fefc3ac.tar.bz2 |
Backport: SF bug #1331563 ] string_subscript doesn't check for failed PyMem_Malloc.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/stringobject.c | 2 |
1 files changed, 2 insertions, 0 deletions
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++) { |