From c6124e01bc87a6be2884fe1c67b29803a3119dc0 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Wed, 15 Jan 2025 08:23:52 -0800 Subject: [PATCH] Avoid overflow in _To_absolute_time(). --- stl/inc/thread | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stl/inc/thread b/stl/inc/thread index 09bda8e0e1..661eb6d2ba 100644 --- a/stl/inc/thread +++ b/stl/inc/thread @@ -169,7 +169,7 @@ _NODISCARD auto _To_absolute_time(const chrono::duration<_Rep, _Period>& _Rel_ti const auto _Now = chrono::steady_clock::now(); decltype(_Now + _Rel_time) _Abs_time = _Now; // return common type if (_Rel_time > _Zero) { - constexpr auto _Forever = (chrono::steady_clock::time_point::max)(); + constexpr auto _Forever = (decltype(_Abs_time)::max)(); if (_Abs_time < _Forever - _Rel_time) { _Abs_time += _Rel_time; } else {