[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
This commit is contained in:
David Majnemer 2015-09-04 07:22:36 +00:00
parent c95358b1ea
commit 5ca46f0df1
1 changed files with 1 additions and 1 deletions

View File

@ -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;