]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-40263: Fixes an off-by-one error in _winapi_WaitForMultipleObjects_impl (GH-19501)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 28 Jul 2021 21:52:11 +0000 (14:52 -0700)
committerGitHub <noreply@github.com>
Wed, 28 Jul 2021 21:52:11 +0000 (22:52 +0100)
(cherry picked from commit 92b5dc780db968f6277f42cb06926dddb7475dc6)

Co-authored-by: Ray Donnelly <mingw.android@gmail.com>
Misc/NEWS.d/next/Windows/2020-04-13-15-20-28.bpo-40263.1KKEbu.rst [new file with mode: 0644]
Modules/_winapi.c

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 (file)
index 0000000..0c31606
--- /dev/null
@@ -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.
index e1672c478522e874e4560fed10828a8b4a4212db..4206bb6c495edf6de84f4e856b62c7b6d1dbfb92 100644 (file)
@@ -1713,7 +1713,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);