aboutsummaryrefslogtreecommitdiffstats
path: root/src/editfns.c
diff options
context:
space:
mode:
authorEli Zaretskii2006-03-25 08:56:07 +0000
committerEli Zaretskii2006-03-25 08:56:07 +0000
commit71c3f28fb7d178e546ce05290ccc4927041dc342 (patch)
tree762915db309e3d85568fc3fb99e31914e9b11e51 /src/editfns.c
parent0f49150ef42e29ee4c1f952b5047826aabd2397b (diff)
downloademacs-71c3f28fb7d178e546ce05290ccc4927041dc342.tar.gz
emacs-71c3f28fb7d178e546ce05290ccc4927041dc342.zip
Move explanations from ChangeLog to the source.
Diffstat (limited to 'src/editfns.c')
-rw-r--r--src/editfns.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/editfns.c b/src/editfns.c
index c4f8b95d810..888bbe3062b 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -1724,6 +1724,8 @@ DOW and ZONE.) */)
1724 XSETFASTINT (list_args[2], decoded_time->tm_hour); 1724 XSETFASTINT (list_args[2], decoded_time->tm_hour);
1725 XSETFASTINT (list_args[3], decoded_time->tm_mday); 1725 XSETFASTINT (list_args[3], decoded_time->tm_mday);
1726 XSETFASTINT (list_args[4], decoded_time->tm_mon + 1); 1726 XSETFASTINT (list_args[4], decoded_time->tm_mon + 1);
1727 /* On 64-bit machines an int is narrower than EMACS_INT, thus the
1728 cast below avoids overflow in int arithmetics. */
1727 XSETINT (list_args[5], TM_YEAR_BASE + (EMACS_INT) decoded_time->tm_year); 1729 XSETINT (list_args[5], TM_YEAR_BASE + (EMACS_INT) decoded_time->tm_year);
1728 XSETFASTINT (list_args[6], decoded_time->tm_wday); 1730 XSETFASTINT (list_args[6], decoded_time->tm_wday);
1729 list_args[7] = (decoded_time->tm_isdst)? Qt : Qnil; 1731 list_args[7] = (decoded_time->tm_isdst)? Qt : Qnil;
@@ -1851,7 +1853,16 @@ but this is considered obsolete. */)
1851 1853
1852 if (! lisp_time_argument (specified_time, &value, NULL)) 1854 if (! lisp_time_argument (specified_time, &value, NULL))
1853 error ("Invalid time specification"); 1855 error ("Invalid time specification");
1856 /* Do not use ctime, since it has undefined behavior with
1857 out-of-range time stamps. This avoids a core dump triggered by
1858 (current-time-string '(2814749767106 0)) on 64-bit Solaris 8. See
1859 <http://www.opengroup.org/austin/mailarchives/ag/msg09294.html>
1860 for more details about this portability problem. */
1854 tm = localtime (&value); 1861 tm = localtime (&value);
1862 /* Checking for out-of-range time stamps avoids buffer overruns that
1863 cause core dump on some systems (e.g., 64-bit Solaris), and also
1864 preserves the historic behavior of always returning a fixed-size
1865 24-character string. */
1855 if (! (tm && -999 - TM_YEAR_BASE <= tm->tm_year 1866 if (! (tm && -999 - TM_YEAR_BASE <= tm->tm_year
1856 && tm->tm_year <= 9999 - TM_YEAR_BASE)) 1867 && tm->tm_year <= 9999 - TM_YEAR_BASE))
1857 error ("Specified time is not representable"); 1868 error ("Specified time is not representable");