Commit d43e9287 authored by Serhiy Storchaka's avatar Serhiy Storchaka

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

Clement Rouault.
parent 32208495
...@@ -1159,6 +1159,7 @@ Guido van Rossum ...@@ -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
......
...@@ -10,6 +10,9 @@ What's New in Python 2.7.11? ...@@ -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
......
...@@ -54,6 +54,11 @@ iter_iternext(PyObject *iterator) ...@@ -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) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment