UBSAN complains about undefined behavior for when I run the antiword utility:
runtime error: left shift of 1 by 63 places cannot be represented in type 'time_t' (aka 'long')
The error is triggered by the macros for TIME_T_MIN
and TIME_T_MAX
below.
#if !defined(TIME_T_MIN)
#define TIME_T_MIN ((time_t)0 < (time_t)-1 ?\
(time_t)0 :\
(time_t)1 << (sizeof(time_t) * CHAR_BIT - 1))
#endif /* TIMER_T_MIN */
#if !defined(TIME_T_MAX)
#if defined(__TURBOC__) /* Turbo C chokes on the subtraction below */
#define TIME_T_MAX (LONG_MAX)
#else /* All others */
#define TIME_T_MAX (~(time_t)0 - TIME_T_MIN)
#endif /* __TURBOC__ */
#endif /* TIME_T_MAX */
I contacted the antiword author and he suggests I find an alternative method to derive the min/max values for time_t
.
What is a cross-platform method of calculating the min/max value of time_t
if you are unsure what the underlying type is?