]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
closes bpo-34477: Objects/typeobject.c: Add missing NULL check to type_init() (GH...
authorAlexey Izbyshev <izbyshev@ispras.ru>
Fri, 24 Aug 2018 04:22:16 +0000 (07:22 +0300)
committerBenjamin Peterson <benjamin@python.org>
Fri, 24 Aug 2018 04:22:16 +0000 (21:22 -0700)
Reported by Svace static analyzer.

Objects/typeobject.c

index a7a9d7bf9fc3357a6bfb7675f3e9643aef60dfb0..af9685d17d5f6504ad38f053ad54c5a01385c5ed 100644 (file)
@@ -2295,6 +2295,9 @@ type_init(PyObject *cls, PyObject *args, PyObject *kwds)
     /* Call object.__init__(self) now. */
     /* XXX Could call super(type, cls).__init__() but what's the point? */
     args = PyTuple_GetSlice(args, 0, 0);
+    if (args == NULL) {
+        return -1;
+    }
     res = object_init(cls, args, NULL);
     Py_DECREF(args);
     return res;