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().
This commit is contained in:
Zackery Spytz 2021-01-03 05:18:25 -07:00 committed by GitHub
parent 9e8fe1986c
commit 5d3553b0a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -0,0 +1 @@
Fix undefined behavior in ``Objects/genericaliasobject.c``.

View 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;
}