[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs current-time-string core dump on 64-bit hosts

From: Richard Stallman
Subject: Re: Emacs current-time-string core dump on 64-bit hosts
Date: Mon, 20 Mar 2006 20:00:50 -0500

    > I think it is possible, even trivial, to fix ctime.  The largest year
    > value that can be represented in a 64-bit time-value is around 1
    > trillion, and that will fit in 12 digits.  Isn't this trivial to fix?

    No, because ctime is implemented in terms of localtime, localtime is
    defined to use an 'int' to represent the year, and 'int' is only 32
    bits on most hosts.

I do not follow you.  If conversion to `int' truncates the year, that
can cause incorrect results, but it can't cause the results to be any
further out of range.  The year in `ctime' will still fit in 12 digits.

Therefore, I still claim that allowing 12 digits for the year in
`ctime's output string will fix the problem of crashes.

However, it can't hurt to also change Emacs to reject extreme
values, until most systems have fixed their `ctime' functions.

The patch you've sent is unnecessarily complex.  The programs
in lib-src can call `ctime' safely because their argument
is the current time.  Only editfns.c needs to be changed.
Would you please put the new code directly into editfns.c?
That would avoid the need for new files, makefile changes, etc.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]