Re: [PATCH 4/5] log: handle integer overflow in timestamps

2014-02-24 Thread Junio C Hamano
Jeff King writes: > On Mon, Feb 24, 2014 at 12:21:33PM -0800, Junio C Hamano wrote: > >> >> > + if (date_overflows(date)) >> >> > + date = 0; >> >> > + else { >> >> > + if (ident->tz_begin && ident->tz_end) >> >> > + tz = strtol(ident-

Re: [PATCH 4/5] log: handle integer overflow in timestamps

2014-02-24 Thread Jeff King
On Mon, Feb 24, 2014 at 12:21:33PM -0800, Junio C Hamano wrote: > >> > +if (date_overflows(date)) > >> > +date = 0; > >> > +else { > >> > +if (ident->tz_begin && ident->tz_end) > >> > +tz = strtol(ident->tz_begin, NULL, 10); >

Re: [PATCH 4/5] log: handle integer overflow in timestamps

2014-02-24 Thread Junio C Hamano
Jeff King writes: > On Mon, Feb 24, 2014 at 11:50:00AM -0800, Junio C Hamano wrote: > >> > We also recognize overflow in the timezone field, which >> > could produce nonsensical results. In this case we show the >> > parsed date, but in UTC. >> >> Both are good measures to fallback to sanity, bu

Re: [PATCH 4/5] log: handle integer overflow in timestamps

2014-02-24 Thread Jeff King
On Mon, Feb 24, 2014 at 11:50:00AM -0800, Junio C Hamano wrote: > > We also recognize overflow in the timezone field, which > > could produce nonsensical results. In this case we show the > > parsed date, but in UTC. > > Both are good measures to fallback to sanity, but why is that > if/else? In

Re: [PATCH 4/5] log: handle integer overflow in timestamps

2014-02-24 Thread Junio C Hamano
Jeff King writes: > If an ident line has a ridiculous date value like (2^64)+1, > we currently just pass ULONG_MAX along to the date code, > which can produce nonsensical dates. > > On systems with a signed long time_t (e.g., 64-bit glibc > systems), this actually doesn't end up too bad. The > UL

[PATCH 4/5] log: handle integer overflow in timestamps

2014-02-23 Thread Jeff King
If an ident line has a ridiculous date value like (2^64)+1, we currently just pass ULONG_MAX along to the date code, which can produce nonsensical dates. On systems with a signed long time_t (e.g., 64-bit glibc systems), this actually doesn't end up too bad. The ULONG_MAX is converted to -1, we ap