Merge
This commit is contained in:
@@ -149,6 +149,9 @@ int upx_decompress ( const upx_bytep src, upx_uint src_len,
|
|||||||
{
|
{
|
||||||
int r = UPX_E_ERROR;
|
int r = UPX_E_ERROR;
|
||||||
|
|
||||||
|
assert(*dst_len > 0);
|
||||||
|
assert(src_len < *dst_len); // must be compressed
|
||||||
|
|
||||||
if (result && result->method == 0)
|
if (result && result->method == 0)
|
||||||
result = NULL;
|
result = NULL;
|
||||||
|
|
||||||
@@ -188,6 +191,7 @@ int upx_test_overlap ( const upx_bytep buf, upx_uint src_off,
|
|||||||
if (result && result->method == 0)
|
if (result && result->method == 0)
|
||||||
result = NULL;
|
result = NULL;
|
||||||
|
|
||||||
|
assert(*dst_len > 0);
|
||||||
assert(src_len < *dst_len); // must be compressed
|
assert(src_len < *dst_len); // must be compressed
|
||||||
unsigned overlap_overhead = src_off + src_len - *dst_len;
|
unsigned overlap_overhead = src_off + src_len - *dst_len;
|
||||||
assert((int)overlap_overhead > 0);
|
assert((int)overlap_overhead > 0);
|
||||||
|
|||||||
+5
-4
@@ -319,23 +319,24 @@ PackLinuxElf32x86::buildLinuxLoader(
|
|||||||
|
|
||||||
unsigned char *const cprLoader = new unsigned char[sizeof(h) + h.sz_unc];
|
unsigned char *const cprLoader = new unsigned char[sizeof(h) + h.sz_unc];
|
||||||
if (0 < szfold) {
|
if (0 < szfold) {
|
||||||
memset(cprLoader, 0, sizeof(h) + h.sz_unc);
|
|
||||||
h.sz_cpr = h.sz_unc; // amount that the compressor may use
|
h.sz_cpr = h.sz_unc; // amount that the compressor may use
|
||||||
int r = upx_compress(uncLoader, h.sz_unc, sizeof(h) + cprLoader, &h.sz_cpr,
|
int r = upx_compress(uncLoader, h.sz_unc, sizeof(h) + cprLoader, &h.sz_cpr,
|
||||||
NULL, ph.method, 10, NULL, NULL );
|
NULL, ph.method, 10, NULL, NULL );
|
||||||
if (r != UPX_E_OK || h.sz_cpr >= h.sz_unc)
|
if (r != UPX_E_OK || h.sz_cpr >= h.sz_unc)
|
||||||
throwInternalError("loader compression failed");
|
throwInternalError("loader compression failed");
|
||||||
|
#if 1 //{
|
||||||
if (M_LZMA==ph.method) { // FIXME: debugging only
|
if (M_LZMA==ph.method) { // FIXME: debugging only
|
||||||
ucl_uint tmp_len = h.sz_unc; // LZMA uses this as EOF
|
ucl_uint tmp_len = h.sz_unc; // LZMA uses this as EOF
|
||||||
unsigned char *tmp = new unsigned char[h.sz_unc];
|
unsigned char *tmp = new unsigned char[tmp_len];
|
||||||
memset(tmp, 0, h.sz_unc);
|
memset(tmp, 0, tmp_len);
|
||||||
r = upx_decompress(sizeof(h) + cprLoader, h.sz_cpr, tmp, &tmp_len, h.b_method, NULL);
|
r = upx_decompress(sizeof(h) + cprLoader, h.sz_cpr, tmp, &tmp_len, h.b_method, NULL);
|
||||||
printf("%d %d: %d %d %d\n", h.b_method, r, h.sz_cpr, h.sz_unc, tmp_len);
|
printf("\n%d %d: %d %d %d\n", h.b_method, r, h.sz_cpr, h.sz_unc, tmp_len);
|
||||||
for (unsigned j=0; j < h.sz_unc; ++j) if (tmp[j]!=uncLoader[j]) {
|
for (unsigned j=0; j < h.sz_unc; ++j) if (tmp[j]!=uncLoader[j]) {
|
||||||
printf("%d: %x %x\n", j, tmp[j], uncLoader[j]);
|
printf("%d: %x %x\n", j, tmp[j], uncLoader[j]);
|
||||||
}
|
}
|
||||||
delete[] tmp;
|
delete[] tmp;
|
||||||
}
|
}
|
||||||
|
#endif //}
|
||||||
}
|
}
|
||||||
memcpy(cprLoader, &h, sizeof(h));
|
memcpy(cprLoader, &h, sizeof(h));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user