Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5d3553b

Browse files
authoredJan 3, 2021
bpo-42814: Fix undefined behavior in Objects/genericaliasobject.c (pythonGH-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().
1 parent 9e8fe19 commit 5d3553b

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix undefined behavior in ``Objects/genericaliasobject.c``.

‎Objects/genericaliasobject.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ is_typing_name(PyObject *obj, int num, ...)
173173
break;
174174
}
175175
}
176+
va_end(names);
176177
if (!hit) {
177178
return 0;
178179
}
@@ -184,7 +185,6 @@ is_typing_name(PyObject *obj, int num, ...)
184185
&& _PyUnicode_EqualToASCIIString(module, "typing");
185186
Py_DECREF(module);
186187

187-
va_end(names);
188188
return res;
189189
}
190190

0 commit comments

Comments
 (0)
Please sign in to comment.