[Python-checkins] bpo-42814: Fix undefined behavior in Objects/genericaliasobject.c (GH-24073)
vstinner
webhook-mailer at python.org
Sun Jan 3 07:18:31 EST 2021
https://github.com/python/cpython/commit/5d3553b0a8959e7505bbec4de03077dbf135ee4b
commit: 5d3553b0a8959e7505bbec4de03077dbf135ee4b
branch: master
author: Zackery Spytz <zspytz at gmail.com>
committer: vstinner <vstinner at python.org>
date: 2021-01-03T13:18:25+01:00
summary:
bpo-42814: Fix undefined behavior in Objects/genericaliasobject.c (GH-24073)
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().
files:
A Misc/NEWS.d/next/Core and Builtins/2021-01-03-04-41-25.bpo-42814.sDvVbb.rst
M 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
index 0000000000000..6978c36f98c96
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2021-01-03-04-41-25.bpo-42814.sDvVbb.rst
@@ -0,0 +1 @@
+Fix undefined behavior in ``Objects/genericaliasobject.c``.
diff --git a/Objects/genericaliasobject.c b/Objects/genericaliasobject.c
index 4cc82ffcdf39a..8fae83b27297d 100644
--- a/Objects/genericaliasobject.c
+++ b/Objects/genericaliasobject.c
@@ -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;
}
More information about the Python-checkins
mailing list