bionic/libc/tzcode
David 'Digit' Turner 2093d350be Fix an infinite loop in time2sub.
The problem is that time_t is signed, and the original code relied on the
fact that (X + c < X) in case of overflow for c >= 0. Unfortunately, this
condition is only guaranteed by the standard for unsigned arithmetic, and
the gcc 4.4.0 optimizer did completely remove the corresponding test from
the code. This resulted in a missing boundary check, and an infinite loop.

The problem is solved by testing explicitely for TIME_T_MIN and TIME_T_MAX
in the loop that uses this.

Also fix increment_overflow and long_increment_overflow which were buggy
for exactly the same reasons.

Note: a similar fix is needed for system/core/libcutils
2009-09-09 17:45:00 -07:00
..
asctime.c auto import //branches/master/...@140412 2009-03-18 22:20:24 -07:00
difftime.c auto import //branches/master/...@140412 2009-03-18 22:20:24 -07:00
localtime.c Fix an infinite loop in time2sub. 2009-09-09 17:45:00 -07:00
private.h auto import //branches/master/...@140412 2009-03-18 22:20:24 -07:00
strftime.c Fix strftime to use localized month names. 2009-08-03 15:43:18 -07:00
strptime.c auto import //branches/master/...@140412 2009-03-18 22:20:24 -07:00
tzfile.h auto import //branches/master/...@140412 2009-03-18 22:20:24 -07:00