Fix the overflow when converting current time to milliseconds on 32bit system
Test: Vts/Cts Bug: 279998685 Change-Id: If8df10e7bb04527e1d9d18f03439bae4ca8dc8fa
This commit is contained in:
parent
f20c0ddd09
commit
50a5f15f5f
1 changed files with 6 additions and 2 deletions
|
@ -520,8 +520,12 @@ AuthKeyData* CredentialData::findAuthKey_(bool allowUsingExhaustedKeys,
|
|||
bool allowUsingExpiredKeys) {
|
||||
AuthKeyData* candidate = nullptr;
|
||||
|
||||
int64_t nowMilliSeconds =
|
||||
std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()) * 1000;
|
||||
time_t now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
|
||||
int64_t nowMilliSeconds;
|
||||
if (__builtin_mul_overflow(int64_t(now), int64_t(1000), &nowMilliSeconds)) {
|
||||
LOG(ERROR) << "Overflow converting " << now << " to milliseconds";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int n = 0;
|
||||
for (AuthKeyData& data : authKeyDatas_) {
|
||||
|
|
Loading…
Reference in a new issue