diff options
author | Kristján Valur Jónsson <sweskman@gmail.com> | 2014-03-05 13:47:57 +0000 |
---|---|---|
committer | Kristján Valur Jónsson <sweskman@gmail.com> | 2014-03-05 13:47:57 +0000 |
commit | 25dded041fe532fcb041b6e68582bf76b4968132 (patch) | |
tree | 3c70fceb3fe5ef98a17b85aa94704d20eb5a853d /Modules/arraymodule.c | |
parent | 4ca688edeb07de955e1ef67c11f0e327f12ffa6e (diff) | |
download | cpython-git-25dded041fe532fcb041b6e68582bf76b4968132.tar.gz |
Make the various iterators' "setstate" sliently and consistently clip the
index. This avoids the possibility of setting an iterator to an invalid
state.
Diffstat (limited to 'Modules/arraymodule.c')
-rw-r--r-- | Modules/arraymodule.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c index 96c9e5bba7..3aba9adbeb 100644 --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -2798,6 +2798,8 @@ arrayiter_setstate(arrayiterobject *it, PyObject *state) return NULL; if (index < 0) index = 0; + else if (index > Py_SIZE(it->ao)) + index = Py_SIZE(it->ao); /* iterator exhausted */ it->index = index; Py_RETURN_NONE; } |