summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Misc/NEWS.d/next/Core and Builtins/2018-10-02-22-55-11.bpo-34879.7VNH2a.rst2
-rw-r--r--Objects/bytesobject.c2
2 files changed, 3 insertions, 1 deletions
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 0000000..5775a21
--- /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 fb344c1..d51d1ba 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 *