diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2006-08-12 02:06:34 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-08-12 02:06:34 (GMT) |
commit | 6b4953fd3d3d1df06f692af67f593d3d0a7aef26 (patch) | |
tree | 6b659e9036a0e6961855205920251a5b0bd6d647 /Modules | |
parent | b45f351832b00c80bf9881e92b12c330324e3116 (diff) | |
download | cpython-6b4953fd3d3d1df06f692af67f593d3d0a7aef26.zip cpython-6b4953fd3d3d1df06f692af67f593d3d0a7aef26.tar.gz cpython-6b4953fd3d3d1df06f692af67f593d3d0a7aef26.tar.bz2 |
Check returned pointer is valid.
Klocwork #233
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_ctypes/cfield.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c index 3595b05..62a5fe6 100644 --- a/Modules/_ctypes/cfield.c +++ b/Modules/_ctypes/cfield.c @@ -105,6 +105,12 @@ CField_FromDesc(PyObject *desc, int index, StgDictObject *idict; if (adict && adict->proto) { idict = PyType_stgdict(adict->proto); + if (!idict) { + PyErr_SetString(PyExc_TypeError, + "has no _stginfo_"); + Py_DECREF(self); + return NULL; + } if (idict->getfunc == getentry("c")->getfunc) { struct fielddesc *fd = getentry("s"); getfunc = fd->getfunc; |