pefile: Allow overlap of MZ header and PE header (h.nexepos==0x10)

https://github.com/upx/upx/issues/169
This means .codebase is aliased to .nexepos, with both equal to 0x10.
	modified:   pefile.cpp
This commit is contained in:
John Reiser 2018-01-21 10:20:53 -08:00
parent 8ab180edf8
commit f056ecdcd5

View File

@ -164,7 +164,7 @@ int PeFile::readFileHeader()
{
unsigned const delta = (h.relocoffs >= 0x40)
? h.nexepos // new format exe
: (h.p512*512+h.m512 - h.m512 ? 512 : 0);
: (h.p512*512+h.m512 - h.m512 ? 512 : h.nexepos);
if ((pe_offset + delta) < delta // wrap-around
|| (pe_offset + delta) > (unsigned)file_size) {