Skip to content

Commit

Permalink
bpo-42814: Fix undefined behavior in Objects/genericaliasobject.c (GH…
Browse files Browse the repository at this point in the history
…-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().
  • Loading branch information
ZackerySpytz committed Jan 3, 2021
1 parent 9e8fe19 commit 5d3553b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
@@ -0,0 +1 @@
Fix undefined behavior in ``Objects/genericaliasobject.c``.
2 changes: 1 addition & 1 deletion Objects/genericaliasobject.c
Expand Up @@ -173,6 +173,7 @@ is_typing_name(PyObject *obj, int num, ...)
break;
}
}
va_end(names);
if (!hit) {
return 0;
}
Expand All @@ -184,7 +185,6 @@ is_typing_name(PyObject *obj, int num, ...)
&& _PyUnicode_EqualToASCIIString(module, "typing");
Py_DECREF(module);

va_end(names);
return res;
}

Expand Down

0 comments on commit 5d3553b

Please sign in to comment.