Skip to content

Commit

Permalink
bpo-40263: Fixes an off-by-one error in _winapi_WaitForMultipleObject…
Browse files Browse the repository at this point in the history
…s_impl (GH-19501)

(cherry picked from commit 92b5dc7)

Co-authored-by: Ray Donnelly <mingw.android@gmail.com>
  • Loading branch information
miss-islington and mingwandroid committed Jul 28, 2021
1 parent 369d148 commit bccb7b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This is a follow-on bug from https://bugs.python.org/issue26903. Once that
is applied we run into an off-by-one assertion problem. The assert was not
correct.
2 changes: 1 addition & 1 deletion Modules/_winapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1722,7 +1722,7 @@ _winapi_WaitForMultipleObjects_impl(PyObject *module, PyObject *handle_seq,
nhandles = PySequence_Length(handle_seq);
if (nhandles == -1)
return NULL;
if (nhandles < 0 || nhandles >= MAXIMUM_WAIT_OBJECTS - 1) {
if (nhandles < 0 || nhandles > MAXIMUM_WAIT_OBJECTS - 1) {
PyErr_Format(PyExc_ValueError,
"need at most %zd handles, got a sequence of length %zd",
MAXIMUM_WAIT_OBJECTS - 1, nhandles);
Expand Down

0 comments on commit bccb7b9

Please sign in to comment.