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

M_LZMA bug tracking: decompress fails but says OK

This commit is contained in:
John Reiser 2006-06-22 17:18:17 -07:00
parent fec5cc864e
commit 03910d67c3

View File

@ -319,12 +319,17 @@ PackLinuxElf32x86::buildLinuxLoader(
unsigned char *const cprLoader = new unsigned char[sizeof(h) + h.sz_unc];
if (0 < szfold) {
unsigned sz_cpr = 0;
int r = upx_compress(uncLoader, h.sz_unc, sizeof(h) + cprLoader, &sz_cpr,
int r = upx_compress(uncLoader, h.sz_unc, sizeof(h) + cprLoader, &h.sz_cpr,
NULL, ph.method, 10, NULL, NULL );
if (r != UPX_E_OK || h.sz_cpr >= h.sz_unc)
throwInternalError("loader compression failed");
h.sz_cpr = sz_cpr;
if (M_LZMA==ph.method) { // FIXME: debugging only
ucl_uint tmp_len = 0;
unsigned char *tmp = new unsigned char[h.sz_unc];
memset(tmp, 0, h.sz_unc);
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);
}
}
memcpy(cprLoader, &h, sizeof(h));