changeset: 96188:274c1b0a2494 branch: 2.7 parent: 96172:cbe28273fd8d user: Serhiy Storchaka date: Thu May 21 20:49:34 2015 +0300 files: Misc/ACKS Misc/NEWS Objects/iterobject.c description: Issue #23985: Fixed integer overflow in iterator object. Original patch by Clement Rouault. diff -r cbe28273fd8d -r 274c1b0a2494 Misc/ACKS --- a/Misc/ACKS Wed May 20 18:37:37 2015 +0300 +++ b/Misc/ACKS Thu May 21 20:49:34 2015 +0300 @@ -1159,6 +1159,7 @@ Just van Rossum Hugo van Rossum Saskia van Rossum +Clement Rouault Donald Wallace Rouse II Liam Routt Todd Rovito diff -r cbe28273fd8d -r 274c1b0a2494 Misc/NEWS --- a/Misc/NEWS Wed May 20 18:37:37 2015 +0300 +++ b/Misc/NEWS Thu May 21 20:49:34 2015 +0300 @@ -10,6 +10,9 @@ 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 -r cbe28273fd8d -r 274c1b0a2494 Objects/iterobject.c --- a/Objects/iterobject.c Wed May 20 18:37:37 2015 +0300 +++ b/Objects/iterobject.c Thu May 21 20:49:34 2015 +0300 @@ -54,6 +54,11 @@ 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) {