mirror of
https://github.com/upx/upx.git
synced 2025-08-11 22:52:30 +08:00
Also verifyOverlappingDecompression() for watcom/le.
This commit is contained in:
@ -566,6 +566,9 @@ void PackWcle::pack(OutputFile *fo)
|
||||
|
||||
writeFile(fo, opt->watcom_le.le);
|
||||
|
||||
// verify
|
||||
verifyOverlappingDecompression(oimage + e_len, oimage.getSize() - e_len);
|
||||
|
||||
// copy the overlay
|
||||
const unsigned overlaystart = ih.data_pages_offset + exe_offset
|
||||
+ getImageSize();
|
||||
|
@ -366,9 +366,8 @@ void ph_decompress(PackHeader &ph, const upx_bytep in, upx_bytep out,
|
||||
// verify checksum of decompressed data
|
||||
if (verify_checksum)
|
||||
{
|
||||
if (ft) {
|
||||
if (ft)
|
||||
ft->unfilter(out, ph.u_len);
|
||||
}
|
||||
adler = upx_adler32(out, ph.u_len, ph.saved_u_adler);
|
||||
if (adler != ph.u_adler)
|
||||
throwChecksumError();
|
||||
@ -450,6 +449,20 @@ void Packer::verifyOverlappingDecompression(Filter *ft)
|
||||
}
|
||||
|
||||
|
||||
void Packer::verifyOverlappingDecompression(upx_bytep o_ptr, unsigned o_size, Filter *ft)
|
||||
{
|
||||
assert(ph.c_len < ph.u_len);
|
||||
assert((int)ph.overlap_overhead > 0);
|
||||
if (ph_skipVerify(ph))
|
||||
return;
|
||||
unsigned offset = (ph.u_len + ph.overlap_overhead) - ph.c_len;
|
||||
if (offset + ph.c_len > o_size)
|
||||
return;
|
||||
memmove(o_ptr + offset, o_ptr, ph.c_len);
|
||||
decompress(o_ptr + offset, o_ptr, true, ft);
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// Find overhead for in-place decompression in an heuristic way
|
||||
// (using a binary search). Return 0 on error.
|
||||
|
@ -209,7 +209,8 @@ protected:
|
||||
unsigned range = 0,
|
||||
unsigned upper_limit = ~0u) const;
|
||||
// destructive decompress + verify
|
||||
virtual void verifyOverlappingDecompression(Filter *ft = NULL);
|
||||
void verifyOverlappingDecompression(Filter *ft = NULL);
|
||||
void verifyOverlappingDecompression(upx_bytep o_ptr, unsigned o_size, Filter *ft = NULL);
|
||||
|
||||
// packheader handling
|
||||
virtual int patchPackHeader(void *b, int blen);
|
||||
|
Reference in New Issue
Block a user