mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
SF bug #1331563 ] string_subscript doesn't check for failed PyMem_Malloc. Will backport
This commit is contained in:
parent
5c4a9d6591
commit
95c1e5065c
1 changed files with 2 additions and 0 deletions
|
@ -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++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue