[llvm-commits] [llvm] r134427 - /llvm/trunk/lib/Object/COFFObjectFile.cpp
Benjamin Kramer
benny.kra at googlemail.com
Tue Jul 5 12:08:30 PDT 2011
On 05.07.2011, at 20:41, Rafael Espindola wrote:
> Author: rafael
> Date: Tue Jul 5 13:41:47 2011
> New Revision: 134427
>
> URL: http://llvm.org/viewvc/llvm-project?rev=134427&view=rev
> Log:
> Compare all 4 bytes of the header.
>
> Modified:
> llvm/trunk/lib/Object/COFFObjectFile.cpp
>
> Modified: llvm/trunk/lib/Object/COFFObjectFile.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/COFFObjectFile.cpp?rev=134427&r1=134426&r2=134427&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Object/COFFObjectFile.cpp (original)
> +++ llvm/trunk/lib/Object/COFFObjectFile.cpp Tue Jul 5 13:41:47 2011
> @@ -309,8 +309,9 @@
> if (!checkSize(Data, ec, 0x3c + 8)) return;
> HeaderStart += *reinterpret_cast<const ulittle32_t *>(base() + 0x3c);
> // Check the PE header. ("PE\0\0")
> - if (StringRef(reinterpret_cast<const char *>(base() + HeaderStart), 4)
> - != "PE\0\0") {
> + StringRef Actual(reinterpret_cast<const char *>(base() + HeaderStart), 4);
> + StringRef Expcted("PE\0\0", 4);
> + if (Actual != Expcted) {
> ec = object_error::parse_failed;
> return;
> }
Typo: Expcted
also, a plain memcmp would be easier on the eyes
if (std::memcmp(base() + HeaderStart, "PE\0\0", 4))
More information about the llvm-commits
mailing list