From ca8343842f9094fd5eb86569d293250e783f582c Mon Sep 17 00:00:00 2001 From: Hans Boehm Date: Wed, 26 Aug 2020 21:41:13 -0700 Subject: Avoid NanoSleep overflow NanoSleep with a very large argument could cause it to fail on 32 bits. It doesn't appear to me that this was ever exposed to client code. So this was probably not an observable bug. Remove redundant uses of "constexpr inline" instead of adding another one. Bug: 161006928 Test: Treehugger Change-Id: I2ad3b92d01c764915ab2aac17cc72ac5c6907ed4 --- libartbase/base/time_utils.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libartbase/base/time_utils.cc') diff --git a/libartbase/base/time_utils.cc b/libartbase/base/time_utils.cc index d38d885f5d..037d7b59a3 100644 --- a/libartbase/base/time_utils.cc +++ b/libartbase/base/time_utils.cc @@ -216,7 +216,7 @@ uint64_t ProcessCpuNanoTime() { void NanoSleep(uint64_t ns) { timespec tm; - tm.tv_sec = ns / MsToNs(1000); + tm.tv_sec = SaturatedTimeT(ns / MsToNs(1000)); tm.tv_nsec = ns - static_cast(tm.tv_sec) * MsToNs(1000); nanosleep(&tm, nullptr); } -- cgit v1.2.3-59-g8ed1b