roxen.lists.pike.general

Subject Author Date
Pike 7.8.316 beta Martin Stjernholm <6341[at]lyskom[dot]lysator[dot]liu[dot]se> 30-06-2009
That doesn't make it any better, though. The reason is this commit by
srb:

revision 1.241
date: 2008/08/26 18:34:44;  author: srb;  state: Exp;  lines: +32 -22
Fix buffer overflows when converting Pike floats to stringformat.

@@ -1609,7 +1618,8 @@
 	goto append_buffer;
 
       case T_FLOAT:
-	sprintf(buffer,"%"PRINTPIKEFLOAT"f",sp[e].u.float_number);
+	sprintf(buffer,"%.*"PRINTPIKEFLOAT"g",
+         MAX_FLOAT_PREC_LEN, sp[e].u.float_number);
 #ifdef PIKE_DEBUG
 	if (strlen (buffer) > MAX_FLOAT_SPRINTF_LEN)
 	  Pike_fatal ("Formatted float %s is %"PRINTSIZET"u, "

The intention is not bad - using the "f" specifier with a big exponent
produces a very long string of digits. However, "g" happily removes
all trailing zeroes, and also the decimal point if possible.