summaryrefslogtreecommitdiffstats
path: root/Objects/iterobject.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-05-21 17:50:25 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-05-21 17:50:25 (GMT)
commit4faf5c5655277cec99b2b11f7fe34e73d3ae28b9 (patch)
treeaefe265087e545e5277383bf21d90ced3cdf4022 /Objects/iterobject.c
parentcbfe07e06cb460986b37604bc32dad407cb33f62 (diff)
downloadcpython-4faf5c5655277cec99b2b11f7fe34e73d3ae28b9.zip
cpython-4faf5c5655277cec99b2b11f7fe34e73d3ae28b9.tar.gz
cpython-4faf5c5655277cec99b2b11f7fe34e73d3ae28b9.tar.bz2
Issue #23985: Fixed integer overflow in iterator object. Patch by
Clement Rouault.
Diffstat (limited to 'Objects/iterobject.c')
-rw-r--r--Objects/iterobject.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Objects/iterobject.c b/Objects/iterobject.c
index 77ff810..3047d6b 100644
--- a/Objects/iterobject.c
+++ b/Objects/iterobject.c
@@ -54,6 +54,11 @@ iter_iternext(PyObject *iterator)
seq = it->it_seq;
if (seq == NULL)
return NULL;
+ if (it->it_index == PY_SSIZE_T_MAX) {
+ PyErr_SetString(PyExc_OverflowError,
+ "iter index too large");
+ return NULL;
+ }
result = PySequence_GetItem(seq, it->it_index);
if (result != NULL) {