Don't pack Cotrol Flow Guard PE files
This commit is contained in:
committed by
Markus F.X.J. Oberhumer
parent
c1a55b063e
commit
6a85bab5da
+6
-2
@@ -2107,7 +2107,8 @@ void PeFile::readSectionHeaders(unsigned objs, unsigned sizeof_ih)
|
||||
}
|
||||
|
||||
void PeFile::checkHeaderValues(unsigned subsystem, unsigned mask,
|
||||
unsigned ih_entry, unsigned ih_filealign)
|
||||
unsigned ih_entry, unsigned ih_filealign,
|
||||
unsigned ih_dllflags)
|
||||
{
|
||||
if ((1u << subsystem) & ~mask)
|
||||
{
|
||||
@@ -2131,6 +2132,9 @@ void PeFile::checkHeaderValues(unsigned subsystem, unsigned mask,
|
||||
|
||||
if (ih_filealign < 0x200)
|
||||
throwCantPack("filealign < 0x200 is not yet supported");
|
||||
|
||||
if (ih_dllflags & IMAGE_DLLCHARACTERISTICS_CONTROL_FLOW_GUARD)
|
||||
throwCantPack("CFGuard enabled PE files are not supported");
|
||||
}
|
||||
|
||||
unsigned PeFile::handleStripRelocs(upx_uint64_t ih_imagebase,
|
||||
@@ -2240,7 +2244,7 @@ void PeFile::pack0(OutputFile *fo, ht &ih, ht &oh,
|
||||
readSectionHeaders(objs, sizeof(ih));
|
||||
if (!opt->force && handleForceOption())
|
||||
throwCantPack("unexpected value in PE header (try --force)");
|
||||
checkHeaderValues(ih.subsystem, subsystem_mask, ih.entry, ih.filealign);
|
||||
checkHeaderValues(ih.subsystem, subsystem_mask, ih.entry, ih.filealign, ih.dllflags);
|
||||
|
||||
//remove certificate directory entry
|
||||
if (IDSIZE(PEDIR_SEC))
|
||||
|
||||
Reference in New Issue
Block a user