10000 gh-128961: Fix exhausted array iterator crash in `__setstate__` by tom-pytel · Pull Request #128962 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-128961: Fix exhausted array iterator crash in __setstate__ #128962

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jan 18, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
nit picked
  • Loading branch information
tom-pytel committed Jan 17, 2025
commit e7f00dc0bbbe40c864d646c87b0bdc72f39f9d2f
6 changes: 4 additions & 2 deletions Modules/arraymodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -3092,10 +3092,12 @@ array_arrayiterator___setstate__(arrayiterobject *self, PyObject *state)
return NULL;
arrayobject *ao = self->ao;
if (ao != NULL) {
if (index < 0)
if (index < 0) {
index = 0;
else if (index > Py_SIZE(ao))
}
else if (index > Py_SIZE(ao)) {
index = Py_SIZE(ao); /* iterator exhausted */
}
self->index = index;
}
Py_RETURN_NONE;
Expand Down
Loading
0