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

Clement Rouault.
This commit is contained in:
Serhiy Storchaka 2015-05-21 20:49:34 +03:00
parent 3220849524
commit d43e928753
3 changed files with 9 additions and 0 deletions

View File

@ -1159,6 +1159,7 @@ Guido van Rossum
Just van Rossum Just van Rossum
Hugo van Rossum Hugo van Rossum
Saskia van Rossum Saskia van Rossum
Clement Rouault
Donald Wallace Rouse II Donald Wallace Rouse II
Liam Routt Liam Routt
Todd Rovito Todd Rovito

View File

@ -10,6 +10,9 @@ What's New in Python 2.7.11?
Core and Builtins Core and Builtins
----------------- -----------------
- Issue #23985: Fixed integer overflow in iterator object. Original patch by
Clement Rouault.
- Issue #24102: Fixed exception type checking in standard error handlers. - Issue #24102: Fixed exception type checking in standard error handlers.
Library Library

View File

@ -54,6 +54,11 @@ iter_iternext(PyObject *iterator)
seq = it->it_seq; seq = it->it_seq;
if (seq == NULL) if (seq == NULL)
return NULL; return NULL;
if (it->it_index == LONG_MAX) {
PyErr_SetString(PyExc_OverflowError,
"iter index too large");
return NULL;
}
result = PySequence_GetItem(seq, it->it_index); result = PySequence_GetItem(seq, it->it_index);
if (result != NULL) { if (result != NULL) {