Issue #23985: Fixed integer overflow in iterator object. Patch by

Clement Rouault.
This commit is contained in:
Serhiy Storchaka 2015-05-21 20:51:53 +03:00
commit b2f3c2357c
3 changed files with 33 additions and 0 deletions

View file

@ -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) {