https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93456

            Bug ID: 93456
           Summary: No overflow check in
                    __atomic_futex_unsigned_base::_M_futex_wait_until
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

#include <future>
#include <climits>

int main()
{
  std::promise<void> p;
  auto f = p.get_future();
  auto now = std::chrono::system_clock::now();
  std::chrono::seconds s(INT_MAX + 10ull);
  f.wait_until(now + s);
}

On 32-bit linux with a 32-bit time_t this fails to wait and returns
immediately.

The problem is __atomic_futex_unsigned_base::_M_futex_wait_until which doesn't
check whether __s.count() - tv.tv_sec fits in time_t.

Reply via email to