On Sun, 27 Mar 2016 14:30:35 +0100 Connor Lane Smith <[email protected]> wrote:
> On 27 March 2016 at 14:20, Mattias Andrée > <[email protected]> wrote: > > The timestamp happened to be negative > > which caused strftime (glibc) in ls to segfault. > > I can't reproduce this with negative timestamps for > strftime on glibc. It would also be a bug on their end, > as far as I'm concerned. > > cls > The problem occur when tv_sec < -67768040609745132L. It is not a bug in glibc. What happens is that tm_year would overflow and therefore localtime returns NULL. However, in musl this problem occur already at tv_sec < -67768040604561132L, 2 months = 60 days before the overflow happens. Of course, overflow can also occur on large positive. times. This overflow happens when tv_sec > 67768036191673199L. Both glibc and musl support tv_sec = 67768036191673199L. I think the best solution would be check whether localtime returns NULL.
pgpo1t7BK9WLs.pgp
Description: OpenPGP digital signature
