Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 19 Jul 2013 21:22:26 -0400
From: Rich Felker <>
Subject: Re: time code progress

On Sat, Jul 20, 2013 at 03:11:06AM +0200, Szabolcs Nagy wrote:
> * Rich Felker <> [2013-07-17 05:33:25 -0400]:
> > Committed. Please let me know what bugs you find. :-)
> in mktime the overflow check is not strictly ok,
> time_t is signed so the check relies on signed overflow

A conversion is not an overflow. If the actual value does not fit, it
results in an implementation-defined value (of the destination type)
or an implementation-defined signal. I'm happy assuming our
implementation does not do the latter, and even that it performs the
conversion via modular reduction, but we don't need that assumption
here. The fact that, if t does not fit in time_t, then NO value of
type time_t can ever be equal to t, is all we need.

> time_t seem to be long on all supported platforms so this should work:
> if (t>LONG_MAX || t<LONG_MIN) goto error;

And then we would have to fix it when we add x32...


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.