[Python-checkins] closes bpo-34477: Objects/typeobject.c: Add missing NULL check to type_init() (GH-8876)

Miss Islington (bot) webhook-mailer at python.org
Fri Aug 24 00:49:33 EDT 2018


https://github.com/python/cpython/commit/fbe359a5e0b22e96065d24d033bebf27cdb374be
commit: fbe359a5e0b22e96065d24d033bebf27cdb374be
branch: 3.6
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2018-08-24T00:49:29-04:00
summary:

closes bpo-34477: Objects/typeobject.c: Add missing NULL check to type_init() (GH-8876)


Reported by Svace static analyzer.
(cherry picked from commit f6247aac08c1a79d0479145a405718bb76dba434)

Co-authored-by: Alexey Izbyshev <izbyshev at ispras.ru>

files:
M Objects/typeobject.c

diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 69b1878fd8f2..bbc383a695b8 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -2235,6 +2235,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;



More information about the Python-checkins mailing list