From d43e9287538326b1e18c2212a32892efe506ccdd Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Thu, 21 May 2015 20:49:34 +0300 Subject: Issue #23985: Fixed integer overflow in iterator object. Original patch by Clement Rouault. --- Misc/ACKS | 1 + Misc/NEWS | 3 +++ Objects/iterobject.c | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/Misc/ACKS b/Misc/ACKS index 2262c79..8187174 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 2bb7c2d..0e41300 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 5a9a2dd..9c90abe 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) { -- cgit v0.12