+2018-09-02 Paul Eggert <eggert@cs.ucla.edu>
+
+ mktime: fix unlikely race+overflow bug
+ Problem reported by Alexandre Oliva in:
+ https://sourceware.org/bugzilla/show_bug.cgi?id=16346
+ * lib/mktime.c (__mktime_internal): Access *OFFSET only once,
+ to avoid an unlikely race if the compiler delays a load and
+ if this cascades into a signed integer overflow.
+
2018-08-31 Paul Eggert <eggert@cs.ucla.edu>
mktime, timegm: simplify glibc time64_t
long_int lmday = mday;
long_int yday = mon_yday + lmday;
+ mktime_offset_t off = *offset;
int negative_offset_guess;
int sec_requested = sec;
/* Invert CONVERT by probing. First assume the same offset as last
time. */
- INT_SUBTRACT_WRAPV (0, *offset, &negative_offset_guess);
+ INT_SUBTRACT_WRAPV (0, off, &negative_offset_guess);
t0 = ydhms_diff (year, yday, hour, min, sec,
EPOCH_YEAR - TM_YEAR_BASE, 0, 0, 0, negative_offset_guess);