diff options
author | HongWeipeng <hongweichen8888@sina.com> | 2019-09-08 10:15:56 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2019-09-08 10:15:56 (GMT) |
commit | 3c87a667bb367ace1de6bd1577fdb4f66947da52 (patch) | |
tree | e5fd31e977fc7d8041cb85c432de6715b055d55d /Objects | |
parent | 32a960f8e1015b64b4b955b3d62920c5903d4c6f (diff) | |
download | cpython-3c87a667bb367ace1de6bd1577fdb4f66947da52.zip cpython-3c87a667bb367ace1de6bd1577fdb4f66947da52.tar.gz cpython-3c87a667bb367ace1de6bd1577fdb4f66947da52.tar.bz2 |
bpo-36946:Fix possible signed integer overflow when handling slices. (GH-15639)
This is a complement to PR 13375.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/listobject.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c index 5fca08e..645742b 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -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) { |