summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2009-03-29 16:25:46 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2009-03-29 16:25:46 (GMT)
commitdb6fa182a7cb8dbf1072aa2f54893dec54a1f96e (patch)
tree5ad19f7c5bd5890945e9add358f033ea3a7e0e9d /Objects
parent87886195405dd28f259f839d2c4410b0309077b9 (diff)
downloadcpython-db6fa182a7cb8dbf1072aa2f54893dec54a1f96e.zip
cpython-db6fa182a7cb8dbf1072aa2f54893dec54a1f96e.tar.gz
cpython-db6fa182a7cb8dbf1072aa2f54893dec54a1f96e.tar.bz2
Merged revisions 70684 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r70684 | mark.dickinson | 2009-03-29 17:24:29 +0100 (Sun, 29 Mar 2009) | 3 lines Issue #532631: Apply floatformat changes to unicodeobject.c as well as stringobject.c. ........
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 70c95a1..acec713 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -8228,6 +8228,15 @@ formatfloat(Py_UNICODE *buf,
return -1;
if (prec < 0)
prec = 6;
+ /* make sure that the decimal representation of precision really does
+ need at most 10 digits: platforms with sizeof(int) == 8 exist! */
+ if (prec > 0x7fffffffL) {
+ PyErr_SetString(PyExc_OverflowError,
+ "outrageously large precision "
+ "for formatted float");
+ return -1;
+ }
+
if (type == 'f' && fabs(x) >= 1e50)
type = 'g';
/* Worst case length calc to ensure no buffer overrun: