1
0
mirror of https://github.com/upx/upx synced 2025-09-28 19:06:07 +08:00

Enabled compressWithFilters(). Added some assertions.

committer: mfx <mfx> 978108380 +0000
This commit is contained in:
Markus F.X.J. Oberhumer 2000-12-29 16:46:20 +00:00
parent 63ead04054
commit 82698fb4b0

View File

@ -1614,7 +1614,7 @@ void PackW32Pe::pack(OutputFile *fo)
obuf.allocForCompression(ph.u_len); obuf.allocForCompression(ph.u_len);
ph.u_len -= rvamin; ph.u_len -= rvamin;
#if 1 #if 0
// filter // filter
Filter ft(opt->level); Filter ft(opt->level);
if (allow_filter) if (allow_filter)
@ -1632,7 +1632,6 @@ void PackW32Pe::pack(OutputFile *fo)
buildLoader(&ft); buildLoader(&ft);
#else #else
// new version using compressWithFilters() // new version using compressWithFilters()
// FIXME - this does not work yet !!!
// prepare packheader // prepare packheader
ph.filter = 0; ph.filter = 0;
@ -1856,6 +1855,7 @@ void PackW32Pe::pack(OutputFile *fo)
//for (ic = 0; ic < oh.filealign; ic += 4) //for (ic = 0; ic < oh.filealign; ic += 4)
// set_le32(ibuf + ic,get_le32("UPX ")); // set_le32(ibuf + ic,get_le32("UPX "));
assert(oh.filealign <= ibuf.getSize());
memset(ibuf,0,oh.filealign); memset(ibuf,0,oh.filealign);
infoHeader("[Writing compressed file]"); infoHeader("[Writing compressed file]");
@ -1865,7 +1865,11 @@ void PackW32Pe::pack(OutputFile *fo)
fo->write(osection,sizeof(osection)); fo->write(osection,sizeof(osection));
// some alignment // some alignment
if (identsplit == identsize) if (identsplit == identsize)
fo->write(ibuf,osection[0].rawdataptr - fo->getBytesWritten() - identsize); {
unsigned n = osection[0].rawdataptr - fo->getBytesWritten() - identsize;
assert(n <= oh.filealign);
fo->write(ibuf, n);
}
fo->write(loader + codesize,identsize); fo->write(loader + codesize,identsize);
infoWriting("loader", fo->getBytesWritten()); infoWriting("loader", fo->getBytesWritten());
fo->write(obuf,clen); fo->write(obuf,clen);