diff --git a/.pick_status.json b/.pick_status.json index 20246491748..8479c4cf278 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -4994,7 +4994,7 @@ "description": "util: Fix the integer addition in os_time_get_absolute_timeout()", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "7316cc92f3810c9e53a22c35343190d8fb7980be", "notes": null diff --git a/src/util/os_time.c b/src/util/os_time.c index 37548a8544b..40949abb6eb 100644 --- a/src/util/os_time.c +++ b/src/util/os_time.c @@ -97,7 +97,9 @@ os_time_get_absolute_timeout(uint64_t timeout) return OS_TIMEOUT_INFINITE; time = os_time_get_nano(); - abs_timeout = time + (int64_t)timeout; + + /* Do the addition in unsigned, because signed overflow is UB, then convert to signed again. */ + abs_timeout = (uint64_t)time + (uint64_t)timeout; /* Check for overflow. */ if (abs_timeout < time)