* FORMAT spec
@ 2003-12-19 22:52 Sriram Thaiyar
0 siblings, 0 replies; only message in thread
From: Sriram Thaiyar @ 2003-12-19 22:52 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-12-19 22:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-19 22:52 FORMAT spec Sriram Thaiyar
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).