summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-05-21 17:51:53 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-05-21 17:51:53 (GMT)
commitb2f3c2357c5bcc871cb3c789cae223faf0b472d1 (patch)
tree5eab5d85dd0122c7b40aead43188031550cd85cf /Objects
parent041dd8eef105f981693f7084b270481816dd9a7a (diff)
parent4faf5c5655277cec99b2b11f7fe34e73d3ae28b9 (diff)
downloadcpython-b2f3c2357c5bcc871cb3c789cae223faf0b472d1.zip
cpython-b2f3c2357c5bcc871cb3c789cae223faf0b472d1.tar.gz
cpython-b2f3c2357c5bcc871cb3c789cae223faf0b472d1.tar.bz2
Issue #23985: Fixed integer overflow in iterator object. Patch by
Clement Rouault.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/iterobject.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Objects/iterobject.c b/Objects/iterobject.c
index baa51da..2fb0c88 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 == PY_SSIZE_T_MAX) {
+ PyErr_SetString(PyExc_OverflowError,
+ "iter index too large");
+ return NULL;
+ }
result = PySequence_GetItem(seq, it->it_index);
if (result != NULL) {