]> code.delx.au - gnu-emacs/commitdiff
(Fformat): Detect invalid format letters for floats.
authorRichard M. Stallman <rms@gnu.org>
Sat, 26 Oct 2002 22:52:36 +0000 (22:52 +0000)
committerRichard M. Stallman <rms@gnu.org>
Sat, 26 Oct 2002 22:52:36 +0000 (22:52 +0000)
src/editfns.c

index 3b71d592bd152ab5dd0918e300a355197366c669..51cf0c0b789cabd3c6d5ccb06951050a568796d5 100644 (file)
@@ -3259,7 +3259,12 @@ usage: (format STRING &rest OBJECTS)  */)
        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