bpo-36946:Fix possible signed integer overflow when handling slices. (GH-15639)

This is a complement to PR 13375.
This commit is contained in:
HongWeipeng 2019-09-08 18:15:56 +08:00 committed by Serhiy Storchaka
parent 32a960f8e1
commit 3c87a667bb
4 changed files with 12 additions and 3 deletions

View file

@ -2789,7 +2789,8 @@ list_subscript(PyListObject* self, PyObject* item)
return list_item(self, i);
}
else if (PySlice_Check(item)) {
Py_ssize_t start, stop, step, slicelength, cur, i;
Py_ssize_t start, stop, step, slicelength, i;
size_t cur;
PyObject* result;
PyObject* it;
PyObject **src, **dest;
@ -2925,7 +2926,8 @@ list_ass_subscript(PyListObject* self, PyObject* item, PyObject* value)
/* assign slice */
PyObject *ins, *seq;
PyObject **garbage, **seqitems, **selfitems;
Py_ssize_t cur, i;
Py_ssize_t i;
size_t cur;
/* protect against a[::-1] = a */
if (self == (PyListObject*)value) {