]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-42814: Fix undefined behavior in Objects/genericaliasobject.c (GH-24073)
authorZackery Spytz <zspytz@gmail.com>
Sun, 3 Jan 2021 12:18:25 +0000 (05:18 -0700)
committerGitHub <noreply@github.com>
Sun, 3 Jan 2021 12:18:25 +0000 (13:18 +0100)
In is_typing_name(), va_end() is not always called before the
function returns.  It is undefined behavior to call va_start()
without also calling va_end().

Misc/NEWS.d/next/Core and Builtins/2021-01-03-04-41-25.bpo-42814.sDvVbb.rst [new file with mode: 0644]
Objects/genericaliasobject.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2021-01-03-04-41-25.bpo-42814.sDvVbb.rst b/Misc/NEWS.d/next/Core and Builtins/2021-01-03-04-41-25.bpo-42814.sDvVbb.rst
new file mode 100644 (file)
index 0000000..6978c36
--- /dev/null
@@ -0,0 +1 @@
+Fix undefined behavior in ``Objects/genericaliasobject.c``.
index 4cc82ffcdf39a341240244d9b4f47dfdcb91f061..8fae83b27297d0209721a68c4f0a3d10ab18fa9b 100644 (file)
@@ -173,6 +173,7 @@ is_typing_name(PyObject *obj, int num, ...)
             break;
         }
     }
+    va_end(names);
     if (!hit) {
         return 0;
     }
@@ -184,7 +185,6 @@ is_typing_name(PyObject *obj, int num, ...)
         && _PyUnicode_EqualToASCIIString(module, "typing");
     Py_DECREF(module);
     
-    va_end(names);
     return res;
 }