From 3a03e9fb6f4b24f375af4c8965a74c9949b4de75 Mon Sep 17 00:00:00 2001 From: Silent Date: Mon, 30 Dec 2024 18:30:40 +0100 Subject: [PATCH] Fix a Y2038 bug by replacing Int32x32To64 with regular multiplication Int32x32To64 macro internally truncates the arguments to int32, while time_t is 64-bit on most/all modern platforms. Therefore, usage of this macro creates a Year 2038 bug. --- omaha/base/time.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/omaha/base/time.cc b/omaha/base/time.cc index b9b7b4138..62a4f5ad8 100644 --- a/omaha/base/time.cc +++ b/omaha/base/time.cc @@ -300,7 +300,7 @@ time_t FileTimeToTimeT(const FILETIME& file_time) { void TimeTToFileTime(const time_t& time, FILETIME* file_time) { ASSERT1(file_time); - LONGLONG ll = Int32x32To64(time, kSecsTo100ns) + kTimeTConvValue; + LONGLONG ll = (static_cast(time) * kSecsTo100ns) + kTimeTConvValue; file_time->dwLowDateTime = static_cast(ll); file_time->dwHighDateTime = static_cast(ll >> 32); }