mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +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
|
|
@ -4198,7 +4198,8 @@ formatfloat(char *buf, size_t buflen, int flags,
|
|||
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