From: Serhiy Storchaka Date: Thu, 21 May 2015 17:49:34 +0000 (+0300) Subject: Issue #23985: Fixed integer overflow in iterator object. Original patch by X-Git-Tag: v2.7.11rc1~302^2~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d43e9287538326b1e18c2212a32892efe506ccdd;p=thirdparty%2FPython%2Fcpython.git Issue #23985: Fixed integer overflow in iterator object. Original patch by Clement Rouault. --- diff --git a/Misc/ACKS b/Misc/ACKS index 2262c79350e0..818717412e04 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1159,6 +1159,7 @@ Guido van Rossum Just van Rossum Hugo van Rossum Saskia van Rossum +Clement Rouault Donald Wallace Rouse II Liam Routt Todd Rovito diff --git a/Misc/NEWS b/Misc/NEWS index 2bb7c2d4cde4..0e4130085c53 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ What's New in Python 2.7.11? 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. Library diff --git a/Objects/iterobject.c b/Objects/iterobject.c index 5a9a2dd7a090..9c90abe6012e 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 == LONG_MAX) { + PyErr_SetString(PyExc_OverflowError, + "iter index too large"); + return NULL; + } result = PySequence_GetItem(seq, it->it_index); if (result != NULL) {