Re-commit r278066: Do not ignore SizeOfOptionalHeader in COFF header even if PE header is not present.

llvm-svn: 278429
This commit is contained in:
Rui Ueyama 2016-08-11 22:02:44 +00:00
parent 8e0c53a018
commit 8950a53821
1 changed files with 3 additions and 1 deletions

View File

@ -718,9 +718,11 @@ COFFObjectFile::COFFObjectFile(MemoryBufferRef Object, std::error_code &EC)
}
if ((EC = getObject(DataDirectory, Data, DataDirAddr, DataDirSize)))
return;
CurPtr += COFFHeader->SizeOfOptionalHeader;
}
if (COFFHeader)
CurPtr += COFFHeader->SizeOfOptionalHeader;
if ((EC = getObject(SectionTable, Data, base() + CurPtr,
(uint64_t)getNumberOfSections() * sizeof(coff_section))))
return;