From: Rafael Espindola Date: Tue, 5 Jul 2011 18:41:47 +0000 (+0000) Subject: Compare all 4 bytes of the header. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=82c475d0579e2d7519bdf75b3efa44f6b9759c21;p=oota-llvm.git Compare all 4 bytes of the header. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134427 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Object/COFFObjectFile.cpp b/lib/Object/COFFObjectFile.cpp index 158263e5b10..00038071ead 100644 --- a/lib/Object/COFFObjectFile.cpp +++ b/lib/Object/COFFObjectFile.cpp @@ -309,8 +309,9 @@ COFFObjectFile::COFFObjectFile(MemoryBuffer *Object, error_code &ec) if (!checkSize(Data, ec, 0x3c + 8)) return; HeaderStart += *reinterpret_cast(base() + 0x3c); // Check the PE header. ("PE\0\0") - if (StringRef(reinterpret_cast(base() + HeaderStart), 4) - != "PE\0\0") { + StringRef Actual(reinterpret_cast(base() + HeaderStart), 4); + StringRef Expcted("PE\0\0", 4); + if (Actual != Expcted) { ec = object_error::parse_failed; return; }