Kaydet (Commit) d4814bfa authored tarafından Mark Dickinson's avatar Mark Dickinson

Issue #532631: Apply floatformat changes to unicodeobject.c

as well as stringobject.c.
üst 174e9098
......@@ -8286,6 +8286,15 @@ formatfloat(Py_UNICODE *buf,
return -1;
if (prec < 0)
prec = 6;
/* make sure that the decimal representation of precision really does
need at most 10 digits: platforms with sizeof(int) == 8 exist! */
if (prec > 0x7fffffffL) {
PyErr_SetString(PyExc_OverflowError,
"outrageously large precision "
"for formatted float");
return -1;
}
if (type == 'f' && fabs(x) >= 1e50)
type = 'g';
/* Worst case length calc to ensure no buffer overrun:
......
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