Skip to content

Commit e3c2b67

Browse files
committed
gh-138008: fix segfault in _cyptes during _build_callargs
Signed-off-by: Manjusaka <[email protected]>
1 parent 9ee0214 commit e3c2b67

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Modules/_ctypes/_ctypes.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4374,7 +4374,11 @@ _build_callargs(ctypes_state *st, PyCFuncPtrObject *self, PyObject *argtypes,
43744374
callargs = PyTuple_New(len); /* the argument tuple we build */
43754375
if (callargs == NULL)
43764376
return NULL;
4377-
4377+
if (!_validate_paramflags(st, Py_TYPE(self), argtypes)) {
4378+
PyErr_SetString(PyExc_TypeError,
4379+
"the current argument is invalid");
4380+
goto error;
4381+
}
43784382
#ifdef MS_WIN32
43794383
/* For a COM method, skip the first arg */
43804384
if (self->index) {

0 commit comments

Comments
 (0)