diff options
author | Alexey Izbyshev <izbyshev@ispras.ru> | 2018-08-20 20:04:19 (GMT) |
---|---|---|
committer | Berker Peksag <berker.peksag@gmail.com> | 2018-08-20 20:04:19 (GMT) |
commit | cdbf50cba1664f72ae6621a89c324a32fea70377 (patch) | |
tree | fd5bb4fe8e06f467a05a704f214be8b9a904d1db /Modules/_abc.c | |
parent | 4c8555773a801f957297132a92c0acb382d640e4 (diff) | |
download | cpython-cdbf50cba1664f72ae6621a89c324a32fea70377.zip cpython-cdbf50cba1664f72ae6621a89c324a32fea70377.tar.gz cpython-cdbf50cba1664f72ae6621a89c324a32fea70377.tar.bz2 |
bpo-34441: Fix ABC.__subclasscheck__ crash on classes with invalid __subclasses__ (GH-8835)
The missing NULL check was reported by Svace static analyzer.
Diffstat (limited to 'Modules/_abc.c')
-rw-r--r-- | Modules/_abc.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/_abc.c b/Modules/_abc.c index 562a2e6..ce9140f 100644 --- a/Modules/_abc.c +++ b/Modules/_abc.c @@ -665,6 +665,9 @@ _abc__abc_subclasscheck_impl(PyObject *module, PyObject *self, /* 6. Check if it's a subclass of a subclass (recursive). */ subclasses = PyObject_CallMethod(self, "__subclasses__", NULL); + if (subclasses == NULL) { + goto end; + } if (!PyList_Check(subclasses)) { PyErr_SetString(PyExc_TypeError, "__subclasses__() must return a list"); goto end; |