From: Sriram Thaiyar <sri@asu.edu>
Subject: FORMAT spec
Date: Fri, 19 Dec 2003 15:52:59 -0700 [thread overview]
Message-ID: <5i6hdzwpghg.fsf@general2.asu.edu> (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
reply other threads:[~2003-12-19 22:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5i6hdzwpghg.fsf@general2.asu.edu \
--to=sri@asu.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).