Mercurial > cpython-lru_cache-weakref
diff Objects/stringobject.c @ 42216:86d1dbfc5833 legacy-trunk
Patch #1673759: add a missing overflow check when formatting floats
with %G.
| author | Georg Brandl <georg@python.org> |
|---|---|
| date | Thu, 12 Jul 2007 08:38:00 +0000 |
| parents | b94f284805be |
| children | 6620a510e9a9 |
line wrap: on
line diff
--- a/Objects/stringobject.c Thu Jul 12 08:11:29 2007 +0000 +++ b/Objects/stringobject.c Thu Jul 12 08:38:00 2007 +0000 @@ -4198,7 +4198,8 @@ 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?)");
