[PATCH] Correctly handle signed 32-bit time_t types
authorNoah Meyerhans <noahm@debian.org>
Thu, 14 May 2026 17:29:38 +0000 (13:29 -0400)
committerNoah Meyerhans <noahm@debian.org>
Thu, 14 May 2026 17:29:38 +0000 (13:29 -0400)
commit8f7d72687ce097c3f3f881f90274a99dbe3923d1
treeb97b5e9bc88e3cb30aa1386c4bc2edd45f62d573
parent6e628c09b43fc7699d79b076bdc523264308f425
[PATCH] Correctly handle signed 32-bit time_t types

Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1124541
Forwarded: no

dovecot handles 32-bit time_t in a couple of different ways, but neither quite
works currently.  Setting TIME_T_MAX_BITS to 31 isn't correctly handled in
places where time_t values are constructed, for example in
io_loop_get_wait_time().

Similarly, setting TIME_T_MAX_BITS = 32 and defining TIME_T_SIGNED is not
correctly handled by tm_is_too_large().

This change fixes tm_is_too_large() to set max_time to the correct maximum date
representable by a signed 32-bit time_t.

Closes: #1124541
Gbp-Pq: Name Correctly_handle_signed_32-bit_time_t_types.patch
src/lib-imap/imap-date.c
src/lib-imap/test-imap-date.c