mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
Add Packer::hasLoaderSection() to handle missing CFLUSH sections.
This commit is contained in:
parent
6c8bb3a22e
commit
d54f947c98
|
@ -193,7 +193,9 @@ PackLinuxElf::addStubEntrySections(Filter const *)
|
||||||
: M_IS_NRV2B(ph.method) ? "NRV_HEAD,NRV2B,NRV_TAIL"
|
: M_IS_NRV2B(ph.method) ? "NRV_HEAD,NRV2B,NRV_TAIL"
|
||||||
: M_IS_LZMA(ph.method) ? "LZMA_ELF00,+80C,LZMA_DEC20,LZMA_DEC30"
|
: M_IS_LZMA(ph.method) ? "LZMA_ELF00,+80C,LZMA_DEC20,LZMA_DEC30"
|
||||||
: NULL), NULL);
|
: NULL), NULL);
|
||||||
addLoader("CFLUSH,ELFMAINY,IDENTSTR,+40,ELFMAINZ,FOLDEXEC", NULL);
|
if (hasLoaderSection("CFLUSH"))
|
||||||
|
addLoader("CFLUSH");
|
||||||
|
addLoader("ELFMAINY,IDENTSTR,+40,ELFMAINZ,FOLDEXEC", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,9 @@ PackMachBase<T>::addStubEntrySections(Filter const *)
|
||||||
: M_IS_NRV2B(ph.method) ? "NRV_HEAD,NRV2B,NRV_TAIL"
|
: M_IS_NRV2B(ph.method) ? "NRV_HEAD,NRV2B,NRV_TAIL"
|
||||||
: M_IS_LZMA(ph.method) ? "LZMA_ELF00,LZMA_DEC20,LZMA_DEC30"
|
: M_IS_LZMA(ph.method) ? "LZMA_ELF00,LZMA_DEC20,LZMA_DEC30"
|
||||||
: NULL), NULL);
|
: NULL), NULL);
|
||||||
addLoader("CFLUSH,ELFMAINY,IDENTSTR,+40,ELFMAINZ,FOLDEXEC", NULL);
|
if (hasLoaderSection("CFLUSH"))
|
||||||
|
addLoader("CFLUSH");
|
||||||
|
addLoader("ELFMAINY,IDENTSTR,+40,ELFMAINZ,FOLDEXEC", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PackMachI386::addStubEntrySections(Filter const *ft)
|
void PackMachI386::addStubEntrySections(Filter const *ft)
|
||||||
|
|
|
@ -1121,6 +1121,11 @@ int Packer::getLoaderSize() const
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Packer::hasLoaderSection(const char *name) const
|
||||||
|
{
|
||||||
|
void *section = linker->findSection(name, false);
|
||||||
|
return section != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
int Packer::getLoaderSection(const char *name, int *slen) const
|
int Packer::getLoaderSection(const char *name, int *slen) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -240,6 +240,7 @@ protected:
|
||||||
#else
|
#else
|
||||||
void __acc_cdecl_va addLoaderVA(const char *s, ...);
|
void __acc_cdecl_va addLoaderVA(const char *s, ...);
|
||||||
#endif
|
#endif
|
||||||
|
virtual bool hasLoaderSection(const char *name) const;
|
||||||
virtual int getLoaderSection(const char *name, int *slen=NULL) const;
|
virtual int getLoaderSection(const char *name, int *slen=NULL) const;
|
||||||
virtual int getLoaderSectionStart(const char *name, int *slen=NULL) const;
|
virtual int getLoaderSectionStart(const char *name, int *slen=NULL) const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user