diff --git a/src/stub/a_lx_elf64.c b/src/stub/a_lx_elf64.c index df2d70c6..0d64dad5 100644 --- a/src/stub/a_lx_elf64.c +++ b/src/stub/a_lx_elf64.c @@ -170,6 +170,8 @@ upx_bzero(char *p, size_t len) } while (--len); } #define bzero upx_bzero +#else +#define bzero(a,b) __builtin_memset(a,0,b) #endif /*}*/ static void @@ -317,8 +319,8 @@ upx_main( // returns entry address Extent xo, xi1, xi2; xo.buf = (char *)ehdr; xo.size = bi->sz_unc; - xi2.buf = (char *)bi; xi2.size = sz_compressed; - xi1.buf = (char *)bi; xi1.size = sz_compressed; + xi2.buf = CONST_CAST(char *, bi); xi2.size = sz_compressed; + xi1.buf = CONST_CAST(char *, bi); xi1.size = sz_compressed; // ehdr = Uncompress Ehdr and Phdrs unpackExtent(&xi2, &xo, f_decompress, 0); // never filtered? diff --git a/src/stub/fold_machppc32.h b/src/stub/fold_machppc32.h index abc8ba29..34866ac2 100644 --- a/src/stub/fold_machppc32.h +++ b/src/stub/fold_machppc32.h @@ -1,4 +1,4 @@ -/* fold_machppc32.h -- created from fold_machppc32.bin, 1544 (0x608) bytes +/* fold_machppc32.h -- created from fold_machppc32.bin, 1528 (0x5f8) bytes This file is part of the UPX executable compressor. @@ -27,11 +27,11 @@ */ -#define FOLD_MACHPPC32_SIZE 1544 -#define FOLD_MACHPPC32_ADLER32 0xa57805a9 -#define FOLD_MACHPPC32_CRC32 0x2fb8902f +#define FOLD_MACHPPC32_SIZE 1528 +#define FOLD_MACHPPC32_ADLER32 0xb665fdb7 +#define FOLD_MACHPPC32_CRC32 0x0feee296 -unsigned char fold_machppc32[1544] = { +unsigned char fold_machppc32[1528] = { 72, 0, 0,105, 40, 6, 0,208, 76,130, 0, 32, 84,132,240,191, /* 0x 0 */ 77,130, 0, 32, 60, 0, 0, 16,124, 4, 0, 64, 65,128, 0, 8, /* 0x 10 */ 124, 4, 3,120, 56,165, 1, 32,124,103, 27,120, 56, 99,255,252, /* 0x 20 */ @@ -42,7 +42,7 @@ unsigned char fold_machppc32[1544] = { 124, 41, 11,120,125, 8, 2,166,128,159,255,248,124,100,248, 80, /* 0x 70 */ 128,195, 0, 24, 40, 6, 8, 0, 65,129, 0, 8, 56,192, 8, 0, /* 0x 80 */ 124, 61, 11,120,124, 38, 8, 80,124, 37, 11,120, 56, 33,255,232, /* 0x 90 */ -127,231,251,120, 72, 0, 4, 37,127,161,235,120,128, 67, 0, 0, /* 0x a0 */ +127,231,251,120, 72, 0, 4, 33,127,161,235,120,128, 67, 0, 0, /* 0x a0 */ 124, 73, 3,166,128, 67, 0,136,124, 79,241, 32,128, 67, 0,140, /* 0x b0 */ 124, 65, 3,166,128, 67, 0,144,124, 72, 3,166,184,131, 0, 24, /* 0x c0 */ 128, 3, 0, 8,128, 67, 0, 16,128, 99, 0, 20, 78,128, 4, 32, /* 0x d0 */ @@ -72,7 +72,7 @@ unsigned char fold_machppc32[1544] = { 127,132, 0, 0, 64,190,255,172,136,193, 0, 25, 49, 61,255,255, /* 0x 250 */ 124, 9,233, 16,125, 38, 0,208, 85, 41, 15,254,125, 43, 0, 57, /* 0x 260 */ 65,162, 0, 20,128,127, 0, 4,127,168, 3,166,136,161, 0, 26, /* 0x 270 */ - 78,128, 0, 33,129, 97, 0, 20,128, 30, 0, 4,129, 62, 0, 0, /* 0x 280 */ + 78,128, 0, 33,128, 30, 0, 4,129, 97, 0, 20,129, 62, 0, 0, /* 0x 280 */ 124, 0, 90, 20,125, 43, 72, 80,144, 30, 0, 4,145, 62, 0, 0, /* 0x 290 */ 72, 0, 0, 16,124, 4, 3,120,127,195,243,120, 75,255,254,117, /* 0x 2a0 */ 129, 97, 0, 16,129, 63, 0, 0,128, 31, 0, 4,125, 43, 72, 80, /* 0x 2b0 */ @@ -82,51 +82,50 @@ unsigned char fold_machppc32[1544] = { 190, 97, 0, 28,125,128, 0, 38, 58,224, 0, 0,124,122, 27,120, /* 0x 2f0 */ 144, 1, 0, 84,124,155, 35,120,128, 3, 0, 16,124,179, 43,120, /* 0x 300 */ 145,129, 0, 24,124,212, 51,120,127,151, 0, 64,124,245, 59,120, /* 0x 310 */ -125, 22, 67,120, 59,195, 0, 28, 59, 0, 0, 0, 64,156, 1,124, /* 0x 320 */ -129, 62, 0, 0, 47,137, 0, 1, 64,190, 1, 48,129, 62, 0, 24, /* 0x 330 */ +125, 22, 67,120, 59,195, 0, 28, 59, 0, 0, 0, 64,156, 1,120, /* 0x 320 */ +129, 62, 0, 0, 47,137, 0, 1, 64,190, 1, 44,129, 62, 0, 24, /* 0x 330 */ 129,126, 0, 36, 85, 61, 5, 62,128, 30, 0, 28,127,139,234, 20, /* 0x 340 */ 145, 97, 0, 8, 46, 28, 0, 0,127, 41, 2, 20,145, 33, 0, 12, /* 0x 350 */ 127,253, 72, 80, 65,146, 0, 72, 47,155, 0, 0, 64,190, 0, 16, /* 0x 360 */ 47,139, 0, 0, 56,192, 0, 18, 64,158, 0, 8, 56,192, 16, 18, /* 0x 370 */ 47,139, 0, 0,126,103,155,120, 64,158, 0, 8, 56,224,255,255, /* 0x 380 */ 129, 30, 0, 32,127,227,251,120,127,132,227,120, 56,160, 0, 3, /* 0x 390 */ - 75,255,253, 65,127,159, 24, 0, 64,158, 0,128, 47,155, 0, 0, /* 0x 3a0 */ + 75,255,253, 65,127,159, 24, 0, 64,158, 0,124, 47,155, 0, 0, /* 0x 3a0 */ 65,158, 0, 52,128, 30, 0, 36, 47,128, 0, 0, 65,158, 0, 40, /* 0x 3b0 */ 128, 30, 0, 32, 47,128, 0, 0, 64,158, 0, 8,147,244, 0, 0, /* 0x 3c0 */ 127, 99,219,120, 56,129, 0, 8,126,165,171,120,126,198,179,120, /* 0x 3d0 */ 75,255,253,173,124, 28, 0,208,125, 63,226, 20,112, 29, 15,255, /* 0x 3e0 */ 65,130, 0, 24,127,169, 3,166, 56, 0, 0, 0,152, 9, 0, 0, /* 0x 3f0 */ - 57, 41, 0, 1, 66, 0,255,248, 65,178, 0, 40,128,190, 0, 44, /* 0x 400 */ -127,227,251,120,127,132,227,120, 76,198, 49,130, 75,255,252,253, /* 0x 410 */ - 47,131, 0, 0, 65,190, 0, 12, 56, 96, 0,127, 75,255,252,205, /* 0x 420 */ -124, 28,234, 20,127,255, 2, 20,127,159,200, 64, 64,188, 0, 84, /* 0x 430 */ -128,190, 0, 44,124,159,200, 80,127,227,251,120, 56,192, 16, 18, /* 0x 440 */ - 56,224,255,255, 57, 0, 0, 0, 75,255,252,137,127,159, 24, 0, /* 0x 450 */ - 65,190, 0, 48, 75,255,255,196, 56, 9,255,252, 43,128, 0, 1, /* 0x 460 */ - 65,157, 0, 32,128, 30, 0, 8, 47,128, 0, 1, 64,190, 0, 20, /* 0x 470 */ -128, 30, 0, 12, 47,128, 0, 40, 64,190, 0, 8, 58,254, 0, 16, /* 0x 480 */ -128, 26, 0, 16, 59, 24, 0, 1,127,152, 0, 64,128, 30, 0, 4, /* 0x 490 */ -127,222, 2, 20, 75,255,254,136,128, 1, 0, 84,126,227,187,120, /* 0x 4a0 */ -129,129, 0, 24,186, 97, 0, 28,124, 8, 3,166, 56, 33, 0, 80, /* 0x 4b0 */ -125,128,129, 32, 78,128, 0, 32,148, 33,255,192,124, 8, 2,166, /* 0x 4c0 */ -144,129, 0, 8,191, 65, 0, 40,129, 97, 0, 8,124,191, 43,120, /* 0x 4d0 */ -144, 1, 0, 68, 56, 3, 0, 24, 57,107,255,232,144, 1, 0, 20, /* 0x 4e0 */ -145, 97, 0, 16,124,253, 59,120,128, 3, 0, 24,125, 60, 75,120, /* 0x 4f0 */ -200, 1, 0, 16,125, 27, 67,120,124,229, 59,120, 56, 97, 0, 16, /* 0x 500 */ - 56,129, 0, 24,124,218, 51,120, 56,192, 0, 0,144, 1, 0, 24, /* 0x 510 */ -216, 1, 0, 32, 59,192, 0, 0,147,225, 0, 28, 75,255,252, 97, /* 0x 520 */ -127,167,235,120,127,104,219,120,127,227,251,120,127,134,227,120, /* 0x 530 */ - 56,129, 0, 32, 56,160,255,255, 75,255,253,161,128, 31, 0, 16, /* 0x 540 */ -124,123, 27,120, 59,191, 0, 28,127,158, 0, 64, 64,156, 0,148, /* 0x 550 */ -128, 29, 0, 0, 59,222, 0, 1, 56,128, 0, 0, 56,160, 0, 0, /* 0x 560 */ - 47,128, 0, 14, 64,190, 0,104,128,125, 0, 8,124,125, 26, 20, /* 0x 570 */ - 76,198, 49,130, 75,255,251,133,127,228,251,120,124,124, 27,121, /* 0x 580 */ -127, 69,211,120, 65,128, 0, 44, 76,198, 49,130, 75,255,251,101, /* 0x 590 */ - 56,128, 0, 0,127,154, 24, 0,127,133,227,120,127,227,251,120, /* 0x 5a0 */ - 56,192, 0, 0, 56,224, 0, 0, 57, 0, 0, 0, 65,190, 0, 12, /* 0x 5b0 */ - 56, 96, 0,127, 75,255,251, 53, 75,255,253, 33,124,123, 27,120, /* 0x 5c0 */ -127,131,227,120, 76,198, 49,130, 75,255,251, 57,128, 31, 0, 16, /* 0x 5d0 */ -129, 61, 0, 4,127,158, 0, 64,127,189, 74, 20, 75,255,255,112, /* 0x 5e0 */ -128, 1, 0, 68,127, 99,219,120,187, 65, 0, 40, 56, 33, 0, 64, /* 0x 5f0 */ -124, 8, 3,166, 78,128, 0, 32 /* 0x 600 */ + 57, 41, 0, 1, 66, 0,255,248, 65,178, 0, 36,128,190, 0, 44, /* 0x 400 */ +127,227,251,120,127,132,227,120, 75,255,253, 1, 47,131, 0, 0, /* 0x 410 */ + 65,190, 0, 12, 56, 96, 0,127, 75,255,252,209,124, 28,234, 20, /* 0x 420 */ +127,255, 2, 20,127,159,200, 64, 64,188, 0, 84,128,190, 0, 44, /* 0x 430 */ +124,159,200, 80,127,227,251,120, 56,192, 16, 18, 56,224,255,255, /* 0x 440 */ + 57, 0, 0, 0, 75,255,252,141,127,159, 24, 0, 65,190, 0, 48, /* 0x 450 */ + 75,255,255,196, 56, 9,255,252, 43,128, 0, 1, 65,157, 0, 32, /* 0x 460 */ +128, 30, 0, 8, 47,128, 0, 1, 64,190, 0, 20,128, 30, 0, 12, /* 0x 470 */ + 47,128, 0, 40, 64,190, 0, 8, 58,254, 0, 16,128, 26, 0, 16, /* 0x 480 */ + 59, 24, 0, 1,127,152, 0, 64,128, 30, 0, 4,127,222, 2, 20, /* 0x 490 */ + 75,255,254,140,128, 1, 0, 84,126,227,187,120,129,129, 0, 24, /* 0x 4a0 */ +186, 97, 0, 28,124, 8, 3,166, 56, 33, 0, 80,125,128,129, 32, /* 0x 4b0 */ + 78,128, 0, 32,148, 33,255,192,124, 8, 2,166,144,129, 0, 8, /* 0x 4c0 */ +191, 65, 0, 40,129, 97, 0, 8,124,191, 43,120,144, 1, 0, 68, /* 0x 4d0 */ + 56, 3, 0, 24, 57,107,255,232,144, 1, 0, 20,145, 97, 0, 16, /* 0x 4e0 */ +124,253, 59,120,128, 3, 0, 24,125, 60, 75,120,200, 1, 0, 16, /* 0x 4f0 */ +125, 27, 67,120,124,229, 59,120, 56, 97, 0, 16, 56,129, 0, 24, /* 0x 500 */ +124,218, 51,120, 56,192, 0, 0,144, 1, 0, 24,216, 1, 0, 32, /* 0x 510 */ + 59,192, 0, 0,147,225, 0, 28, 75,255,252,101,127,167,235,120, /* 0x 520 */ +127,104,219,120,127,227,251,120,127,134,227,120, 56,129, 0, 32, /* 0x 530 */ + 56,160,255,255, 75,255,253,165,128, 31, 0, 16,124,123, 27,120, /* 0x 540 */ + 59,191, 0, 28,127,158, 0, 64, 64,156, 0,136,128, 29, 0, 0, /* 0x 550 */ + 59,222, 0, 1, 56,128, 0, 0, 56,160, 0, 0, 47,128, 0, 14, /* 0x 560 */ + 64,190, 0, 92,128,125, 0, 8,124,125, 26, 20, 75,255,251,141, /* 0x 570 */ +127,228,251,120,124,124, 27,121,127, 69,211,120, 65,128, 0, 40, /* 0x 580 */ + 75,255,251,113, 56,128, 0, 0,127,154, 24, 0,127,133,227,120, /* 0x 590 */ +127,227,251,120, 56,192, 0, 0, 56,224, 0, 0, 57, 0, 0, 0, /* 0x 5a0 */ + 65,190, 0, 12, 56, 96, 0,127, 75,255,251, 65, 75,255,253, 45, /* 0x 5b0 */ +124,123, 27,120,127,131,227,120, 75,255,251, 73,128, 31, 0, 16, /* 0x 5c0 */ +129, 61, 0, 4,127,158, 0, 64,127,189, 74, 20, 75,255,255,124, /* 0x 5d0 */ +128, 1, 0, 68,127, 99,219,120,187, 65, 0, 40, 56, 33, 0, 64, /* 0x 5e0 */ +124, 8, 3,166, 78,128, 0, 32 /* 0x 5f0 */ }; diff --git a/src/stub/l_armpe.h b/src/stub/l_armpe.h index 92545aea..082deb6d 100644 --- a/src/stub/l_armpe.h +++ b/src/stub/l_armpe.h @@ -1,4 +1,4 @@ -/* l_armpe.h -- created from l_armpe.bin, 565 (0x235) bytes +/* l_armpe.h -- created from l_armpe.bin, 569 (0x239) bytes This file is part of the UPX executable compressor. @@ -27,45 +27,45 @@ */ -#define NRV_LOADER_SIZE 565 -#define NRV_LOADER_ADLER32 0x52a7cd50 -#define NRV_LOADER_CRC32 0x6bf6849d +#define NRV_LOADER_SIZE 569 +#define NRV_LOADER_ADLER32 0x6e94ce29 +#define NRV_LOADER_CRC32 0x6b87ce4a -unsigned char nrv_loader[565] = { +unsigned char nrv_loader[569] = { 15, 64, 45,233, 56, 0,143,226, 14, 0,144,232, 2, 16,129,224, /* 0x 0 */ 0, 32,147,229, 1, 58,131,226, 1, 0, 83,225,251,255,255,154, /* 0x 10 */ 4,224,143,226, 23,192,143,226, 28,255, 47,225, 15, 64,189,232, /* 0x 20 */ 44,192,159,229, 28,255, 47,225, 8, 75, 27,104, 24, 71, 8, 75, /* 0x 30 */ -251,231, 27,224, 83, 82, 67, 48, 83, 82, 67, 76, 68, 83, 84, 48, /* 0x 40 */ +251,231, 29,224, 83, 82, 67, 48, 83, 82, 67, 76, 68, 83, 84, 48, /* 0x 40 */ 68, 83, 84, 76, 66, 73, 77, 80, 79, 78, 65, 77, 71, 69, 84, 80, /* 0x 50 */ - 76, 79, 65, 68, 69, 78, 84, 82, 0,181, 3, 33, 67, 92, 18, 2, /* 0x 60 */ -210, 24, 1, 57,250,213, 16, 28, 2,188, 8, 71,240,181,163,176, /* 0x 70 */ - 0, 35, 2,147, 8,200, 2,200, 4,200, 4, 48, 16,200, 0,104, /* 0x 80 */ - 0,144, 24, 28, 2,171, 1,146, 0,240, 76,248, 37, 28, 40, 28, /* 0x 90 */ -255,247,226,255, 4, 30, 61,208, 0,155, 40, 29,228, 24,255,247, /* 0x a0 */ -219,255, 1,154,134, 24, 3,168, 2, 28, 35,120, 27, 6, 0, 43, /* 0x b0 */ - 4,208, 27, 14, 19,128, 1, 52, 2, 50,246,231, 0, 35, 19,128, /* 0x c0 */ -255,247,181,255, 8, 53, 7, 28, 43,120, 27, 6, 0, 43, 31,208, /* 0x d0 */ - 27, 14, 1, 53, 1, 43, 2,208,255, 43, 13,208,244,231, 56, 28, /* 0x e0 */ - 41, 28,255,247,161,255, 52, 28, 32, 96, 4, 54, 43,120, 27, 6, /* 0x f0 */ - 1, 53, 0, 43,250,209,231,231,105,120, 43,120, 9, 2, 56, 28, /* 0x 100 */ - 89, 24,255,247,145,255, 52, 28, 2, 53, 4, 54, 32, 96,219,231, /* 0x 110 */ - 1, 53,188,231, 35,176,240,188, 1,188, 0, 71, 1,192,143,226, /* 0x 120 */ - 28,255, 47,225,252,181, 15, 24, 1, 36,101, 66,228, 7, 5, 38, /* 0x 130 */ - 54, 2, 15,224, 24,188,192, 27,210, 26, 34, 96,240,188, 2,188, /* 0x 140 */ - 8, 71, 4,120,100, 65, 1, 48, 36, 6,247, 70, 3,120, 1, 48, /* 0x 150 */ - 19,112, 1, 50, 36, 25,254, 70,243,208,247,210, 1, 33, 4,224, /* 0x 160 */ - 1, 57, 36, 25,254, 70,236,208, 73, 65, 36, 25,254, 70,232,208, /* 0x 170 */ - 73, 65, 36, 25,254, 70,228,208,242,211,203, 30, 0, 33, 8,211, /* 0x 180 */ - 27, 2, 5,120, 1, 48, 29, 67,237, 67,211,208,109, 16, 19,210, /* 0x 190 */ - 3,224, 36, 25,254, 70,212,208, 14,210, 1, 33, 36, 25,254, 70, /* 0x 1a0 */ -207,208, 9,210, 36, 25,254, 70,203,208, 73, 65, 36, 25,254, 70, /* 0x 1b0 */ -199,208,247,211, 4, 49, 4,224, 36, 25,254, 70,193,208, 73, 65, /* 0x 1c0 */ - 2, 49,238, 66, 0,210, 1, 49, 19,120, 83, 93, 19,112, 1, 50, /* 0x 1d0 */ - 1, 57,250,209,190,231, 0, 0, 85, 80, 88, 33,161,216,208,213, /* 0x 1e0 */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 1f0 */ - 0, 0, 0, 0, 0, 0, 0, 45, 65, 82, 77, 87, 80, 69, 48, 48, /* 0x 200 */ - 0, 0, 0, 0, 0, 85, 80, 88, 49, 72, 69, 65, 68, 0,232, 1, /* 0x 210 */ - 0, 0, 65, 82, 77, 87, 80, 69, 57, 57, 0, 8, 2, 0, 0,255, /* 0x 220 */ -255,255,255, 8, 2 /* 0x 230 */ + 76, 79, 65, 68, 69, 78, 84, 82, 16,181, 4, 28, 3, 33, 0, 32, /* 0x 60 */ + 99, 92, 2, 2,208, 24, 1, 57,250,213, 16,188, 2,188, 8, 71, /* 0x 70 */ +240,181,163,176, 0, 34, 2,146,130,104, 1,146, 66,105, 3, 28, /* 0x 80 */ + 4,105, 0,146, 89,104, 0,104, 1,154, 2,171, 0,240, 76,248, /* 0x 90 */ + 37, 28, 40, 28,255,247,224,255, 4, 30, 61,208, 0,155, 40, 29, /* 0x a0 */ +228, 24,255,247,217,255, 1,154,134, 24, 3,168, 2, 28, 35,120, /* 0x b0 */ + 27, 6, 0, 43, 4,208, 27, 14, 19,128, 1, 52, 2, 50,246,231, /* 0x c0 */ + 0, 35, 19,128,255,247,179,255, 8, 53, 7, 28, 43,120, 27, 6, /* 0x d0 */ + 0, 43, 31,208, 27, 14, 1, 53, 1, 43, 2,208,255, 43, 13,208, /* 0x e0 */ +244,231, 56, 28, 41, 28,255,247,159,255, 52, 28, 32, 96, 4, 54, /* 0x f0 */ + 43,120, 27, 6, 1, 53, 0, 43,250,209,231,231,105,120, 43,120, /* 0x 100 */ + 9, 2, 56, 28, 89, 24,255,247,143,255, 52, 28, 2, 53, 4, 54, /* 0x 110 */ + 32, 96,219,231, 1, 53,188,231, 35,176,240,188, 1,188, 0, 71, /* 0x 120 */ + 1,192,143,226, 28,255, 47,225,252,181, 15, 24, 1, 36,101, 66, /* 0x 130 */ +228, 7, 5, 38, 54, 2, 15,224, 24,188,192, 27,210, 26, 34, 96, /* 0x 140 */ +240,188, 2,188, 8, 71, 4,120,100, 65, 1, 48, 36, 6,247, 70, /* 0x 150 */ + 3,120, 1, 48, 19,112, 1, 50, 36, 25,254, 70,243,208,247,210, /* 0x 160 */ + 1, 33, 4,224, 1, 57, 36, 25,254, 70,236,208, 73, 65, 36, 25, /* 0x 170 */ +254, 70,232,208, 73, 65, 36, 25,254, 70,228,208,242,211,203, 30, /* 0x 180 */ + 0, 33, 8,211, 27, 2, 5,120, 1, 48, 29, 67,237, 67,211,208, /* 0x 190 */ +109, 16, 19,210, 3,224, 36, 25,254, 70,212,208, 14,210, 1, 33, /* 0x 1a0 */ + 36, 25,254, 70,207,208, 9,210, 36, 25,254, 70,203,208, 73, 65, /* 0x 1b0 */ + 36, 25,254, 70,199,208,247,211, 4, 49, 4,224, 36, 25,254, 70, /* 0x 1c0 */ +193,208, 73, 65, 2, 49,238, 66, 0,210, 1, 49, 19,120, 83, 93, /* 0x 1d0 */ + 19,112, 1, 50, 1, 57,250,209,190,231, 0, 0, 85, 80, 88, 33, /* 0x 1e0 */ +161,216,208,213, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 1f0 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 65, 82, 77, 87, /* 0x 200 */ + 80, 69, 48, 48, 0, 0, 0, 0, 0, 85, 80, 88, 49, 72, 69, 65, /* 0x 210 */ + 68, 0,236, 1, 0, 0, 65, 82, 77, 87, 80, 69, 57, 57, 0, 12, /* 0x 220 */ + 2, 0, 0,255,255,255,255, 12, 2 /* 0x 230 */ }; diff --git a/src/stub/l_armpe_c.c b/src/stub/l_armpe_c.c index 1ee22315..991b2d1c 100644 --- a/src/stub/l_armpe_c.c +++ b/src/stub/l_armpe_c.c @@ -41,10 +41,11 @@ static void *get_le32(const unsigned char *p) //return (void *) (p[0] + p[1] * 0x100 + p[2] * 0x10000 + p[3] * 0x1000000); // the code below is 4 bytes shorter than the above when compiled - unsigned ret; - int ic; - for (ic = 3; ic >= 0; ic--) + unsigned ret = 0; + int ic = 3; + do { ret = ret * 0x100 + p[ic]; + } while (--ic >= 0); return (void *) ret; } @@ -108,7 +109,8 @@ void CHWrap(int); void upx_main(const unsigned *info) { - int dlen = 0; + unsigned dlen = 0; +#if 0 unsigned src0 = *info++; unsigned srcl = *info++; unsigned dst0 = *info++; @@ -118,6 +120,17 @@ void upx_main(const unsigned *info) unsigned getp = *info++; unsigned load = *info++; unsigned entr = *info++; +#else + unsigned src0 = info[0]; + unsigned srcl = info[1]; + unsigned dst0 = info[2]; +// unsigned dstl = info[3]; + unsigned bimp = info[4]; + unsigned onam = info[5]; +// unsigned getp = info[6]; +// unsigned load = info[7]; +// unsigned entr = info[8]; +#endif //WRITEFILE2('0', (void*) 0x11000, load + 256 - 0x11000); ucl_nrv2e_decompress_8((void *) src0, srcl, (void *) dst0, &dlen); diff --git a/src/stub/linux.hh b/src/stub/linux.hh index fb862bcf..b1ac07cc 100644 --- a/src/stub/linux.hh +++ b/src/stub/linux.hh @@ -41,6 +41,8 @@ # endif #endif +#define ACC_UNUSED(var) ((void) var) + /************************************************************************* // diff --git a/src/stub/m_lx_elfppc32.c b/src/stub/m_lx_elfppc32.c index f70cd871..794711e1 100644 --- a/src/stub/m_lx_elfppc32.c +++ b/src/stub/m_lx_elfppc32.c @@ -168,7 +168,7 @@ upx_bzero(char *p, size_t len) static void -auxv_up(Elf32_auxv_t *av, int const type, unsigned const value) +auxv_up(Elf32_auxv_t *av, unsigned type, unsigned const value) { if (av) for (;; ++av) { @@ -306,12 +306,14 @@ void *upx_main( Elf32_Addr entry; Extent xi, xo, xi0; - xi.buf = (char *)(1+ (struct p_info const *)(1+ li)); // &b_info + xi.buf = CONST_CAST(char *, 1+ (struct p_info const *)(1+ li)); // &b_info xi.size = sz_compressed - (sizeof(struct l_info) + sizeof(struct p_info)); xo.buf = (char *)ehdr; xo.size = ((struct b_info const *)xi.buf)->sz_unc; xi0 = xi; + ACC_UNUSED(sz_ehdr); + // ehdr = Uncompress Ehdr and Phdrs unpackExtent(&xi, &xo, f_decompress, 0); // never filtered? diff --git a/src/stub/m_mac_mach32.c b/src/stub/m_mac_mach32.c index 460b7f8f..37020403 100644 --- a/src/stub/m_mac_mach32.c +++ b/src/stub/m_mac_mach32.c @@ -29,8 +29,10 @@ */ -typedef unsigned int size_t; -typedef unsigned long long off_t; +typedef long ssize_t; +typedef unsigned long size_t; +typedef size_t uintptr_t; +__extension__ typedef unsigned long long off_t; typedef unsigned char nrv_byte; typedef unsigned int nrv_uint; @@ -39,7 +41,15 @@ typedef unsigned int nrv_uint; #define PAGE_SIZE -PAGE_MASK #define O_RDONLY 0 -/*extern int exit(int) __attribute__ ((__noreturn__));*/ +int close(int); +void exit(int) __attribute__((__noreturn__)); +int mprotect(void *, size_t, int); +int open(char const *, unsigned, unsigned); +ssize_t read(int, void *, size_t); + +#define CONST_CAST(type, var) \ + ((type) ((uintptr_t) (var))) + /************************************************************************* // configuration section @@ -318,7 +328,7 @@ do_xmap( { Mach_segment_command const *sc = (Mach_segment_command const *)(1+ mhdr); Mach_ppc_thread_state const *entry = 0; - int j; + unsigned j; for ( j=0; j < mhdr->ncmds; ++j, (sc = (Mach_segment_command const *)(sc->cmdsize + (char const *)sc)) @@ -387,7 +397,7 @@ upx_main( { Mach_ppc_thread_state const *entry; Extent xi, xo, xi0; - xi.buf = (char *)(1+ (struct p_info const *)(1+ li)); // &b_info + xi.buf = CONST_CAST(char *, 1+ (struct p_info const *)(1+ li)); // &b_info xi.size = sz_compressed - (sizeof(struct l_info) + sizeof(struct p_info)); xo.buf = (char *)mhdr; xo.size = ((struct b_info const *)xi.buf)->sz_unc; @@ -400,7 +410,7 @@ upx_main( { // Map dyld dynamic loader Mach_load_command const *lc = (Mach_load_command const *)(1+ mhdr); - int j; + unsigned j; for (j=0; j < mhdr->ncmds; ++j, (lc = (Mach_load_command const *)(lc->cmdsize + (char const *)lc)) @@ -411,7 +421,7 @@ upx_main( if (0 > fdi) { err_exit(18); } - if (sz_mhdr!=read(fdi, (void *)mhdr, sz_mhdr)) { + if ((ssize_t)sz_mhdr!=read(fdi, (void *)mhdr, sz_mhdr)) { ERR_LAB err_exit(19); }