summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--generic/tclStringObj.c5
-rw-r--r--tests/format.test6
3 files changed, 15 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 527fa3d..ab6491c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-07-31 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tclStringObj.c: Corrected failure to grow buffer
+ * tests/format.test: when format spec request large width
+ floating point values. Thanks to Clemens Misch. [Bug 2830354]
+
2009-07-24 Andreas Kupries <andreask@activestate.com>
* generic/tclIO.c (Tcl_GetChannelHandle): [Bug 2826248]: Do not crash
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index 093eca3..6e202d5 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -33,7 +33,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclStringObj.c,v 1.70.2.16 2009/07/15 22:27:14 das Exp $ */
+ * RCS: @(#) $Id: tclStringObj.c,v 1.70.2.17 2009/07/31 16:56:32 dgp Exp $ */
#include "tclInt.h"
#include "tommath.h"
@@ -2356,6 +2356,9 @@ Tcl_AppendFormatToObj(
}
if (width) {
p += sprintf(p, "%d", width);
+ if (width > length) {
+ length = width;
+ }
}
if (gotPrecision) {
*p++ = '.';
diff --git a/tests/format.test b/tests/format.test
index 36222a5..48476ab 100644
--- a/tests/format.test
+++ b/tests/format.test
@@ -10,7 +10,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: format.test,v 1.25.2.1 2008/04/07 16:07:02 dgp Exp $
+# RCS: @(#) $Id: format.test,v 1.25.2.2 2009/07/31 16:56:32 dgp Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
@@ -563,6 +563,10 @@ test format-19.2 {Bug 1867855} {
format %llx 0
} 0
+test format-19.3 {Bug 2830354} {
+ string length [format %340f 0]
+} 340
+
# cleanup
catch {unset a}
catch {unset b}