aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2016-12-30 19:02:04 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2016-12-30 19:02:04 +0000
commit1618a653f306006167c076467a9cb0d71154d2cb (patch)
tree4bef9d318a82ceb6e914043bb005fb513d2ff460
parentda362150174d5c2d535ee045413ed31357f8ca16 (diff)
downloadllvm-1618a653f306006167c076467a9cb0d71154d2cb.zip
llvm-1618a653f306006167c076467a9cb0d71154d2cb.tar.gz
llvm-1618a653f306006167c076467a9cb0d71154d2cb.tar.bz2
COFF: replace a magic number and assert more
Assert that the size of the MD5 result is the same size as the signature field being populated. Use the sizeof operator to determine the size of the field being written rather than hardcoding it to the magic number 16. NFC. llvm-svn: 290764
-rw-r--r--lld/COFF/Writer.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lld/COFF/Writer.cpp b/lld/COFF/Writer.cpp
index ae18eb4..3e69aeb 100644
--- a/lld/COFF/Writer.cpp
+++ b/lld/COFF/Writer.cpp
@@ -828,7 +828,10 @@ void Writer::writeBuildId() {
assert(BuildId->DI->Signature.CVSignature == OMF::Signature::PDB70 &&
"only PDB 7.0 is supported");
- memcpy(BuildId->DI->PDB70.Signature, Res, 16);
+ assert(sizeof(Res) == sizeof(BuildId->DI->PDB70.Signature) &&
+ "signature size mismatch");
+ memcpy(BuildId->DI->PDB70.Signature, Res,
+ sizeof(codeview::PDB70DebugInfo::Signature));
// TODO(compnerd) track the Age
BuildId->DI->PDB70.Age = 1;
}