diff --git a/Misc/NEWS.d/next/Core and Builtins/2018-10-02-22-55-11.bpo-34879.7VNH2a.rst b/Misc/NEWS.d/next/Core and Builtins/2018-10-02-22-55-11.bpo-34879.7VNH2a.rst new file mode 100644 index 00000000000..5775a219a27 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2018-10-02-22-55-11.bpo-34879.7VNH2a.rst @@ -0,0 +1,2 @@ +Fix a possible null pointer dereference in bytesobject.c. Patch by Zackery +Spytz. diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index fb344c1896a..d51d1ba023c 100644 --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -448,7 +448,7 @@ formatfloat(PyObject *v, int flags, int prec, int type, result = PyBytes_FromStringAndSize(p, len); PyMem_Free(p); *p_result = result; - return str; + return result != NULL ? str : NULL; } static PyObject *