mirror of
https://github.com/python/cpython.git
synced 2025-07-31 15:14:22 +00:00
Patch #1673759: add a missing overflow check when formatting floats
with %G.
This commit is contained in:
parent
bc5fbd9f8c
commit
7c3b50db66
4 changed files with 24 additions and 5 deletions
|
@ -7294,7 +7294,8 @@ formatfloat(Py_UNICODE *buf,
|
|||
always given), therefore increase the length by one.
|
||||
|
||||
*/
|
||||
if ((type == 'g' && buflen <= (size_t)10 + (size_t)prec) ||
|
||||
if (((type == 'g' || type == 'G') &&
|
||||
buflen <= (size_t)10 + (size_t)prec) ||
|
||||
(type == 'f' && buflen <= (size_t)53 + (size_t)prec)) {
|
||||
PyErr_SetString(PyExc_OverflowError,
|
||||
"formatted float is too long (precision too large?)");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue