changeset 3705:fcf6ccb70eea

[xemacs-hg @ 2006-11-28 13:01:27 by aidan] Fix a crash when (format "%f" 1.2e+302) is evaluated.
author aidan
date Tue, 28 Nov 2006 13:01:29 +0000
parents e2053838832f
children 4ca1ef2bdb6a
files src/ChangeLog src/doprnt.c
diffstat 2 files changed, 10 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Mon Nov 27 22:51:20 2006 +0000
+++ b/src/ChangeLog	Tue Nov 28 13:01:29 2006 +0000
@@ -1,3 +1,10 @@
+2006-11-28  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* doprnt.c (emacs_doprnt_1):
+	Integrate Sebastian Freundt's SXEmacs bug fix for cases where a
+	format specifier overflows the allocated buffer with a float
+	format string. 
+
 2006-11-23  Robert Pluim  <rpluim@gmail.com>
 
 	* sysdep.c (strlwr): Don't intermix declarations and code.
--- a/src/doprnt.c	Mon Nov 27 22:51:20 2006 +0000
+++ b/src/doprnt.c	Tue Nov 28 13:01:29 2006 +0000
@@ -776,16 +776,9 @@
 #endif /* HAVE_BIGFLOAT */
 	  else
 	    {
-	      /* ASCII Decimal representation uses 2.4 times as many
-		 bits as machine binary.  */
-	      char *text_to_print =
-		alloca_array (char, 32 +
-			      max (spec->minwidth,
-				   (int) max (sizeof (double),
-				              sizeof (long)) * 3 +
-				   max (spec->precision, 0)));
-	      char constructed_spec[100];
-	      char *p = constructed_spec;
+	      Ibyte *text_to_print = alloca_array (char, 350);
+	      Ibyte constructed_spec[100];
+	      Ibyte *p = constructed_spec;
 
 	      /* Mostly reconstruct the spec and use sprintf() to
 		 format the string. */