]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #23985: Fixed integer overflow in iterator object. Original patch by
authorSerhiy Storchaka <storchaka@gmail.com>
Thu, 21 May 2015 17:49:34 +0000 (20:49 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Thu, 21 May 2015 17:49:34 +0000 (20:49 +0300)
Clement Rouault.

Misc/ACKS
Misc/NEWS
Objects/iterobject.c

index 2262c79350e014fca746c19f2e1e99fc8ce22a05..818717412e042e4dd5438a539a5be0ec0d58828d 100644 (file)
--- 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
index 2bb7c2d4cde4a2482cd60ca84920fece055c95e1..0e4130085c53b51529b9efb86a1a22aba0f04757 100644 (file)
--- 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
index 5a9a2dd7a090eaa777fcdc89519cdc3596668cbb..9c90abe6012e7f95cb6e3063fbba188866f58568 100644 (file)
@@ -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) {