[Python-checkins] r70685 - in python/branches/release26-maint: Objects/unicodeobject.c

mark.dickinson python-checkins at python.org
Sun Mar 29 18:25:47 CEST 2009


Author: mark.dickinson
Date: Sun Mar 29 18:25:46 2009
New Revision: 70685

Log:
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.
........


Modified:
   python/branches/release26-maint/   (props changed)
   python/branches/release26-maint/Objects/unicodeobject.c

Modified: python/branches/release26-maint/Objects/unicodeobject.c
==============================================================================
--- python/branches/release26-maint/Objects/unicodeobject.c	(original)
+++ python/branches/release26-maint/Objects/unicodeobject.c	Sun Mar 29 18:25:46 2009
@@ -8228,6 +8228,15 @@
         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:


More information about the Python-checkins mailing list