summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-07-28 20:18:01 (GMT)
committerGitHub <noreply@github.com>2021-07-28 20:18:01 (GMT)
commitbccb7b9509e875ef23ec3225d03214ca047e5b1a (patch)
tree37a8153a0895a083a8a5bd59e97f996499481e6a
parent369d1480b7d51b65c08664ecd63c970fb0d573e1 (diff)
downloadcpython-bccb7b9509e875ef23ec3225d03214ca047e5b1a.zip
cpython-bccb7b9509e875ef23ec3225d03214ca047e5b1a.tar.gz
cpython-bccb7b9509e875ef23ec3225d03214ca047e5b1a.tar.bz2
bpo-40263: Fixes an off-by-one error in _winapi_WaitForMultipleObjects_impl (GH-19501)
(cherry picked from commit 92b5dc780db968f6277f42cb06926dddb7475dc6) Co-authored-by: Ray Donnelly <mingw.android@gmail.com>
-rw-r--r--Misc/NEWS.d/next/Windows/2020-04-13-15-20-28.bpo-40263.1KKEbu.rst3
-rw-r--r--Modules/_winapi.c2
2 files changed, 4 insertions, 1 deletions
diff --git a/Misc/NEWS.d/next/Windows/2020-04-13-15-20-28.bpo-40263.1KKEbu.rst b/Misc/NEWS.d/next/Windows/2020-04-13-15-20-28.bpo-40263.1KKEbu.rst
new file mode 100644
index 0000000..0c31606
--- /dev/null
+++ b/Misc/NEWS.d/next/Windows/2020-04-13-15-20-28.bpo-40263.1KKEbu.rst
@@ -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.
diff --git a/Modules/_winapi.c b/Modules/_winapi.c
index f341493..bf2498a 100644
--- a/Modules/_winapi.c
+++ b/Modules/_winapi.c
@@ -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);