mirror of
https://github.com/python/cpython.git
synced 2025-08-21 17:25:34 +00:00
Patch #1673759: add a missing overflow check when formatting floats
with %G. (backport from rev. 56298)
This commit is contained in:
parent
fea72f7c10
commit
c5db923994
4 changed files with 24 additions and 5 deletions
|
@ -7290,7 +7290,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