diff options
| author | Victor Stinner <victor.stinner@gmail.com> | 2013-07-08 22:27:12 (GMT) |
|---|---|---|
| committer | Victor Stinner <victor.stinner@gmail.com> | 2013-07-08 22:27:12 (GMT) |
| commit | 3f15cf0961946702c87e09bc312b2bfec39654b6 (patch) | |
| tree | bc015898d9fca1ba99add897891b7023ac17a02f | |
| parent | 78094ac53eff9bb9a2efadd1b03d8175d773afcd (diff) | |
| download | cpython-3f15cf0961946702c87e09bc312b2bfec39654b6.zip cpython-3f15cf0961946702c87e09bc312b2bfec39654b6.tar.gz cpython-3f15cf0961946702c87e09bc312b2bfec39654b6.tar.bz2 | |
Issue #18408: Fix ConvParam() of the ctypes module to handle paramfunc failure
(MemoryError).
| -rw-r--r-- | Modules/_ctypes/callproc.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c index 7019611..ead1c6f 100644 --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -620,6 +620,8 @@ static int ConvParam(PyObject *obj, Py_ssize_t index, struct argument *pa) assert(dict->paramfunc); /* If it has an stgdict, it is a CDataObject */ carg = dict->paramfunc((CDataObject *)obj); + if (carg == NULL) + return -1; pa->ffi_type = carg->pffi_type; memcpy(&pa->value, &carg->value, sizeof(pa->value)); pa->keep = (PyObject *)carg; |
