diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-09-08 03:36:38 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-08 03:36:38 -0700 |
commit | 021e5db20bc19d678a5b94247a5cdcf689eff006 (patch) | |
tree | b3dcece7c27d0b53b961d69054560459c185bd02 /Objects/listobject.c | |
parent | 30933d57fc4fd3e52123554b67723f13756a70ca (diff) | |
download | cpython-git-021e5db20bc19d678a5b94247a5cdcf689eff006.tar.gz |
bpo-36946:Fix possible signed integer overflow when handling slices. (GH-15639)
This is a complement to PR 13375.
(cherry picked from commit 3c87a667bb367ace1de6bd1577fdb4f66947da52)
Co-authored-by: HongWeipeng <hongweichen8888@sina.com>
Diffstat (limited to 'Objects/listobject.c')
-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 78aa8dea08..c5e7553efc 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -2729,7 +2729,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; @@ -2865,7 +2866,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) { |