mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
ps1/exe: fill pad.code section with zeros.
This commit is contained in:
parent
d822b4a62a
commit
519fa55df7
|
@ -386,8 +386,8 @@ int ElfLinker::addLoader(const char *sname)
|
|||
}
|
||||
memcpy(output + outputlen, section->input, section->size);
|
||||
section->output = output + outputlen;
|
||||
//printf("section added: 0x%04x %3d %s\n", outputlen, section->size, section->name);
|
||||
outputlen += section->size;
|
||||
//printf("section added: %s\n", sect);
|
||||
|
||||
if (head)
|
||||
{
|
||||
|
|
|
@ -345,7 +345,9 @@ void PackPs1::buildLoader(const Filter *)
|
|||
initLoader(nrv_loader, sizeof(nrv_loader));
|
||||
|
||||
pad_code = ALIGN_GAP((ph.c_len + (isCon ? sz_lcpr : 0)), 4);
|
||||
linker->addSection("pad.code", &pad_code, pad_code, 0);
|
||||
assert(pad_code < 4);
|
||||
static const unsigned char pad_buffer[4] = { 0, 0, 0, 0 };
|
||||
linker->addSection("pad.code", pad_buffer, pad_code, 0);
|
||||
|
||||
if (isCon)
|
||||
{
|
||||
|
@ -533,8 +535,6 @@ void PackPs1::pack(OutputFile *fo)
|
|||
oh.bs_ptr = oh.bs_len = 0;
|
||||
|
||||
const int lsize = getLoaderSize();
|
||||
MemBuffer loader(lsize);
|
||||
memcpy(loader, getLoader(), lsize);
|
||||
|
||||
unsigned filelen = ALIGN_UP(ih.tx_len, 4);
|
||||
|
||||
|
@ -614,6 +614,9 @@ void PackPs1::pack(OutputFile *fo)
|
|||
}
|
||||
|
||||
linker->relocate();
|
||||
//linker->dumpSymbols();
|
||||
MemBuffer loader(lsize);
|
||||
assert(lsize == getLoaderSize());
|
||||
memcpy(loader, getLoader(), lsize);
|
||||
patchPackHeader(loader, lsize);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user