[COMMIT] Fix a crash when (format "%f" 1.2e+302) is evaluated
Aidan Kehoe
kehoea at parhasard.net
Tue Nov 28 08:03:38 EST 2006
APPROVE COMMIT
NOTE: This patch has been committed.
See Sebastian’s original patch here:
http://www.sxemacs.org/list-archives/html/sxemacs-patches/2006-10/msg00002.html
and the SXEmacs bug here:
http://issues.sxemacs.org/show_bug.cgi?id=18
for more details. Sebastian could use snprintf in his patch because SXEmacs
only builds on Unix; while I would prefer to do the same, snprintf is not
available in our Windows builds. Maybe we should integrate it when it’s not
available. Thank you for the fix, Sebastian!
src/ChangeLog addition:
2006-11-28 Aidan Kehoe <kehoea at parhasard.net>
* doprnt.c (emacs_doprnt_1):
Integrate Sebastian Freundt's SXEmacs bug fix for cases where a
format specifier overflows the allocated buffer with a float
format string.
XEmacs Trunk source patch:
Diff command: cvs -q diff -u
Files affected: src/doprnt.c
===================================================================
RCS
Index: src/doprnt.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/doprnt.c,v
retrieving revision 1.30
diff -u -r1.30 doprnt.c
--- src/doprnt.c 2005/01/24 23:33:50 1.30
+++ src/doprnt.c 2006/11/28 12:51:43
@@ -776,16 +776,9 @@
#endif /* HAVE_BIGFLOAT */
else
{
- /* ASCII Decimal representation uses 2.4 times as many
- bits as machine binary. */
- char *text_to_print =
- alloca_array (char, 32 +
- max (spec->minwidth,
- (int) max (sizeof (double),
- sizeof (long)) * 3 +
- max (spec->precision, 0)));
- char constructed_spec[100];
- char *p = constructed_spec;
+ Ibyte *text_to_print = alloca_array (char, 350);
+ Ibyte constructed_spec[100];
+ Ibyte *p = constructed_spec;
/* Mostly reconstruct the spec and use sprintf() to
format the string. */
--
Santa Maradona, priez pour moi!
More information about the XEmacs-Patches
mailing list