Commit 96c59327 authored by Zackery Spytz's avatar Zackery Spytz Committed by Serhiy Storchaka

bpo-34879: Fix a possible null pointer dereference in bytesobject.c (GH-9683)

formatfloat() was not checking if PyBytes_FromStringAndSize()
failed, which could lead to a null pointer dereference in
_PyBytes_FormatEx().
parent e006b39a
Fix a possible null pointer dereference in bytesobject.c. Patch by Zackery
Spytz.
......@@ -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 *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment