From: Benjamin Peterson Date: Wed, 27 Aug 2008 00:28:34 +0000 (+0000) Subject: add NULL checking for PyBytes_FromObject; R=Neal X-Git-Tag: v3.0rc1~163 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4b24a42f3c72b4f88da8989a77a175e654dbdcbb;p=python add NULL checking for PyBytes_FromObject; R=Neal --- diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index 3bda6d9945..e924e8d5a3 100644 --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -2932,6 +2932,11 @@ PyBytes_FromObject(PyObject *x) PyObject *new, *it; Py_ssize_t i, size; + if (x == NULL) { + PyErr_BadInternalCall(); + return NULL; + } + /* Is it an int? */ size = PyNumber_AsSsize_t(x, PyExc_ValueError); if (size == -1 && PyErr_Occurred()) {