diff --git a/.pick_status.json b/.pick_status.json index 993363afba8..30cea01dba1 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -94,7 +94,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 7daf828580a..da8ad7a80b8 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)