diff options
Diffstat (limited to 'Objects/iterobject.c')
-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 baa51da..2fb0c88 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) { |