Skip to content

Commit 5d3553b

Browse files
authored
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().
1 parent 9e8fe19 commit 5d3553b

File tree

2 files changed

+2
-1
lines changed

2 files changed

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

Objects/genericaliasobject.c

Lines changed: 1 addition & 1 deletion
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)