SF bug #1331563 ] string_subscript doesn't check for failed PyMem_Malloc. Will backport
This commit is contained in:
parent
5c4a9d6591
commit
95c1e5065c
|
@ -1198,6 +1198,8 @@ string_subscript(PyStringObject* self, PyObject* item)
|
||||||
else {
|
else {
|
||||||
source_buf = PyString_AsString((PyObject*)self);
|
source_buf = PyString_AsString((PyObject*)self);
|
||||||
result_buf = PyMem_Malloc(slicelength);
|
result_buf = PyMem_Malloc(slicelength);
|
||||||
|
if (result_buf == NULL)
|
||||||
|
return PyErr_NoMemory();
|
||||||
|
|
||||||
for (cur = start, i = 0; i < slicelength;
|
for (cur = start, i = 0; i < slicelength;
|
||||||
cur += step, i++) {
|
cur += step, i++) {
|
||||||
|
|
Loading…
Reference in New Issue