summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2007-07-12 08:38:00 (GMT)
committerGeorg Brandl <georg@python.org>2007-07-12 08:38:00 (GMT)
commit7c3b50db6614c677588096191d432e734257a244 (patch)
tree4cb3d1c23d831f1ed5267210be2164317043fce2 /Objects/unicodeobject.c
parentbc5fbd9f8c1a271557846d7aa7a428ae25f901e8 (diff)
downloadcpython-7c3b50db6614c677588096191d432e734257a244.zip
cpython-7c3b50db6614c677588096191d432e734257a244.tar.gz
cpython-7c3b50db6614c677588096191d432e734257a244.tar.bz2
Patch #1673759: add a missing overflow check when formatting floats
with %G.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index ad33b8e..85804f1 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -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?)");