From 5ca46f0df128a6b3868f332fcfd4c10d01152c19 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Fri, 4 Sep 2015 07:22:36 +0000 Subject: [PATCH] [MC] Replace comparison with isUInt<32>. Casting to unsigned long can cause the time to get truncated to 32-bits, making it appear to be a valid timestamp. Just use isUInt<32> instead. llvm-svn: 246840 --- llvm/lib/MC/WinCOFFObjectWriter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/MC/WinCOFFObjectWriter.cpp b/llvm/lib/MC/WinCOFFObjectWriter.cpp index 81facc01eed4..9058edf33254 100644 --- a/llvm/lib/MC/WinCOFFObjectWriter.cpp +++ b/llvm/lib/MC/WinCOFFObjectWriter.cpp @@ -1016,7 +1016,7 @@ void WinCOFFObjectWriter::writeObject(MCAssembler &Asm, // MS LINK expects to be able to use this timestamp to implement their // /INCREMENTAL feature. std::time_t Now = time(nullptr); - if (Now < 0 || (unsigned long)Now > UINT32_MAX) + if (Now < 0 || !isUInt<32>(Now)) Now = UINT32_MAX; Header.TimeDateStamp = Now;