diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-05-21 17:50:25 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-05-21 17:50:25 (GMT) |
commit | 4faf5c5655277cec99b2b11f7fe34e73d3ae28b9 (patch) | |
tree | aefe265087e545e5277383bf21d90ced3cdf4022 /Objects | |
parent | cbfe07e06cb460986b37604bc32dad407cb33f62 (diff) | |
download | cpython-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')
-rw-r--r-- | Objects/iterobject.c | 5 |
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) { |