#3880: integer overflow in date.c (mutt_mktime)
-----------------------+----------------------
Reporter: vinc17 | Owner: mutt-dev
Type: defect | Status: new
Priority: critical | Milestone:
Component: mutt | Version: 1.7.0
Resolution: | Keywords:
-----------------------+----------------------
Comment (by vinc17):
Yes, also assuming that {{{CHAR_BIT}}} is 8 (required by POSIX) and that
there are no padding bits. But your code is wrong, as {{{unsigned long}}}
may not be sufficient, e.g. on x32, where {{{unsigned long}}} has 32 bits
and {{{time_t}}} is defined as {{{long long}}}. But one could use:
{{{
#define TIME_T_MAX ((((time_t) 1 << (sizeof(time_t) * 8 - 2)) - 1) * 2 +
1)
}}}
--
Ticket URL: <https://dev.mutt.org/trac/ticket/3880#comment:3>
Mutt <http://www.mutt.org/>
The Mutt mail user agent