On 20. Feb 2026, at 12.35, John Muccigrosso via dovecot <[email protected]> 
wrote:
> 
> My install via homebrew of 2.4.2 is still crashing regularly. Same problem as 
> before:
> 
>> Feb 20 10:34:05 master: Panic: file ./time-util.h: line 40 
>> (timeval_add_usecs): assertion failed: (usecs >= 0)
> 
> This started with the upgrade to 2.4. I was hoping that the (long in coming) 
> upgrade to the homebrew formula would solve it, but no luck. In fact it might 
> be happening more frequently (just an impression and not something I've 
> actually timed).

When laptop is opened after being suspended, I guess?

This probably fixes it:

commit 3da6d4d08990bcf4eded07156fa61335c5c8ac81
Author: Timo Sirainen <[email protected]>
Date:   Fri Feb 20 13:20:39 2026 +0200

    lib: timeval_add/sub_usecs() - Fix usecs type
    
    Some callers expect it to be 64bit, but suseconds_t isn't guaranteed to be.
    Added assert mainly to catch callers that try to provide negative values
    as parameter, which wrap to large unsigned values.

diff --git a/src/lib/time-util.h b/src/lib/time-util.h
index 00516b11b5..6a0b30d7ba 100644
--- a/src/lib/time-util.h
+++ b/src/lib/time-util.h
@@ -35,9 +35,9 @@ timeval_from_usecs(struct timeval *tv_r, unsigned long usecs)
 }
 
 static inline void
-timeval_add_usecs(struct timeval *tv, suseconds_t usecs)
+timeval_add_usecs(struct timeval *tv, unsigned long long usecs)
 {
-       i_assert(usecs >= 0);
+       i_assert(usecs <= LLONG_MAX);
        tv->tv_sec += (time_t)(usecs / 1000000);
        tv->tv_usec += (usecs % 1000000);
        if (tv->tv_usec >= 1000000) {
@@ -47,9 +47,9 @@ timeval_add_usecs(struct timeval *tv, suseconds_t usecs)
 }
 
 static inline void
-timeval_sub_usecs(struct timeval *tv, suseconds_t usecs)
+timeval_sub_usecs(struct timeval *tv, unsigned long long usecs)
 {
-       i_assert(usecs >= 0);
+       i_assert(usecs <= LLONG_MAX);
        tv->tv_sec -= (time_t)(usecs / 1000000);
        tv->tv_usec -= (usecs % 1000000);
        if (tv->tv_usec < 0) {

_______________________________________________
dovecot mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to