changeset 48020:7ac7ca5ac550

(Fformat): Detect invalid format letters for floats.
author Richard M. Stallman <rms@gnu.org>
date Sat, 26 Oct 2002 22:52:36 +0000
parents ed648a134b7e
children 1c7fc6ad1178
files src/editfns.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/editfns.c	Sat Oct 26 22:49:46 2002 +0000
+++ b/src/editfns.c	Sat Oct 26 22:52:36 2002 +0000
@@ -3259,7 +3259,12 @@
 	else if (FLOATP (args[n]) && *format != 's')
 	  {
 	    if (! (*format == 'e' || *format == 'f' || *format == 'g'))
-	      args[n] = Ftruncate (args[n], Qnil);
+	      {
+		if (*format != 'd' && *format != 'o' && *format != 'x'
+		    && *format != 'i' && *format != 'X' && *format != 'c')
+		  error ("Invalid format operation %%%c", *format);
+		args[n] = Ftruncate (args[n], Qnil);
+	      }
 
 	    /* Note that we're using sprintf to print floats,
 	       so we have to take into account what that function