diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2005-10-20 04:15:52 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2005-10-20 04:15:52 (GMT) |
commit | 95c1e5065ca572a4a3f602487ff6112f089a9257 (patch) | |
tree | 1d7ba512de9a8e529337aafad7ebe86c535392fa | |
parent | 5c4a9d65910e05c4381f96e6af56ee2743abd0d5 (diff) | |
download | cpython-95c1e5065ca572a4a3f602487ff6112f089a9257.zip cpython-95c1e5065ca572a4a3f602487ff6112f089a9257.tar.gz cpython-95c1e5065ca572a4a3f602487ff6112f089a9257.tar.bz2 |
SF bug #1331563 ] string_subscript doesn't check for failed PyMem_Malloc. Will backport
-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 5797eb9..78560de 100644 --- a/Objects/stringobject.c +++ b/Objects/stringobject.c @@ -1198,6 +1198,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++) { |