[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FORMAT spec
From: |
Sriram Thaiyar |
Subject: |
FORMAT spec |
Date: |
Fri, 19 Dec 2003 15:52:59 -0700 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 |
The expression (format "%.2 " -1.0) segfaults GNU Emacs 21.3.1 (under
sparc-sun-solaris2.8) and GNU Emacs 21.2.1 (under GNU/Linux).
This seems to occur because the when the argument to format is a float,
there is no check to see if the format char is a valid character.
Doing the following seems to work (in Fformat in editfns.c):
else if (FLOATP (args[n]) && *format != 's')
{
/** CHECK: Adding the following seems to work. */
if (*format != 'd' && *format != 'o' && *format != 'x'
&& *format != 'i' && *format != 'X' && *format != 'c'
&& *format != 'e' && *format != 'f' && *format != 'g')
error ("Invalid format operation %%%c", *format);
if (! (*format == 'e' || *format == 'f' || *format == 'g'))
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
prints. */
thissize = MAX_10_EXP + 100 + precision;
}
I simply cut and paste the check from the INTEGERP line, and added the
characters 'e', 'f', and 'g'. I haven't checked to see if the above patch
conflicts with anything else. Hope this helps.
-sri
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- FORMAT spec,
Sriram Thaiyar <=