Also verifyOverlappingDecompression() for watcom/le.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
UPX TODO list. Last updated 2006-03-11.
|
UPX TODO list. Last updated 2006-12-06.
|
||||||
|
|
||||||
|
|
||||||
IMPORTANT PROBLEMS THAT SHOULD BE FIXED SOON:
|
IMPORTANT PROBLEMS THAT SHOULD BE FIXED SOON:
|
||||||
@@ -86,10 +86,6 @@ FORMAT WATCOM/LE
|
|||||||
|
|
||||||
- handle holes in the file
|
- handle holes in the file
|
||||||
|
|
||||||
- implement compressWithFilters()
|
|
||||||
|
|
||||||
- add a call to verifyOverlappingDecompression()
|
|
||||||
|
|
||||||
|
|
||||||
FORMAT WIN16/NE
|
FORMAT WIN16/NE
|
||||||
===============
|
===============
|
||||||
|
|||||||
@@ -566,6 +566,9 @@ void PackWcle::pack(OutputFile *fo)
|
|||||||
|
|
||||||
writeFile(fo, opt->watcom_le.le);
|
writeFile(fo, opt->watcom_le.le);
|
||||||
|
|
||||||
|
// verify
|
||||||
|
verifyOverlappingDecompression(oimage + e_len, oimage.getSize() - e_len);
|
||||||
|
|
||||||
// copy the overlay
|
// copy the overlay
|
||||||
const unsigned overlaystart = ih.data_pages_offset + exe_offset
|
const unsigned overlaystart = ih.data_pages_offset + exe_offset
|
||||||
+ getImageSize();
|
+ getImageSize();
|
||||||
|
|||||||
+15
-2
@@ -366,9 +366,8 @@ void ph_decompress(PackHeader &ph, const upx_bytep in, upx_bytep out,
|
|||||||
// verify checksum of decompressed data
|
// verify checksum of decompressed data
|
||||||
if (verify_checksum)
|
if (verify_checksum)
|
||||||
{
|
{
|
||||||
if (ft) {
|
if (ft)
|
||||||
ft->unfilter(out, ph.u_len);
|
ft->unfilter(out, ph.u_len);
|
||||||
}
|
|
||||||
adler = upx_adler32(out, ph.u_len, ph.saved_u_adler);
|
adler = upx_adler32(out, ph.u_len, ph.saved_u_adler);
|
||||||
if (adler != ph.u_adler)
|
if (adler != ph.u_adler)
|
||||||
throwChecksumError();
|
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
|
// Find overhead for in-place decompression in an heuristic way
|
||||||
// (using a binary search). Return 0 on error.
|
// (using a binary search). Return 0 on error.
|
||||||
|
|||||||
+2
-1
@@ -209,7 +209,8 @@ protected:
|
|||||||
unsigned range = 0,
|
unsigned range = 0,
|
||||||
unsigned upper_limit = ~0u) const;
|
unsigned upper_limit = ~0u) const;
|
||||||
// destructive decompress + verify
|
// 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
|
// packheader handling
|
||||||
virtual int patchPackHeader(void *b, int blen);
|
virtual int patchPackHeader(void *b, int blen);
|
||||||
|
|||||||
Reference in New Issue
Block a user