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:
+1
-1
@@ -164,7 +164,7 @@ int PeFile::readFileHeader()
|
|||||||
{
|
{
|
||||||
unsigned const delta = (h.relocoffs >= 0x40)
|
unsigned const delta = (h.relocoffs >= 0x40)
|
||||||
? h.nexepos // new format exe
|
? 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
|
if ((pe_offset + delta) < delta // wrap-around
|
||||||
|| (pe_offset + delta) > (unsigned)file_size) {
|
|| (pe_offset + delta) > (unsigned)file_size) {
|
||||||
|
|||||||
Reference in New Issue
Block a user