arm64 --nrv2d preserve sign when decoding offset

https://github.com/upx/upx/issues/806
	modified:   src/stub/arm64-darwin.macho-entry.h
	modified:   src/stub/arm64-linux.elf-entry.h
	modified:   src/stub/arm64-linux.elf-so_fold.h
	modified:   src/stub/arm64-linux.shlib-init.h
	modified:   src/stub/arm64-win64.pe.h
	modified:   src/stub/src/arch/arm64/v8/nrv2d_d32.S
This commit is contained in:
John Reiser 2024-04-06 16:07:01 -07:00
parent 93abe97ea5
commit bb816f0c74
6 changed files with 16 additions and 16 deletions

View File

@ -33,8 +33,8 @@
/* clang-format off */
#define STUB_ARM64_DARWIN_MACHO_ENTRY_SIZE 7365
#define STUB_ARM64_DARWIN_MACHO_ENTRY_ADLER32 0x31b06f6b
#define STUB_ARM64_DARWIN_MACHO_ENTRY_CRC32 0x0f5ec97d
#define STUB_ARM64_DARWIN_MACHO_ENTRY_ADLER32 0xb6c76f2b
#define STUB_ARM64_DARWIN_MACHO_ENTRY_CRC32 0x34c5965d
unsigned char stub_arm64_darwin_macho_entry[7365] = {
/* 0x0000 */ 127, 69, 76, 70, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@ -82,7 +82,7 @@ unsigned char stub_arm64_darwin_macho_entry[7365] = {
/* 0x02a0 */ 243,255,255,151, 33, 0, 1, 58,241,255,255,151, 33, 0, 1, 58,
/* 0x02b0 */ 239,255,255,151, 67,255,255, 84, 35, 12, 0,113, 1, 0,128, 82,
/* 0x02c0 */ 35, 1, 0, 84, 5, 20, 64, 56,165, 32, 3, 42,229, 3, 37, 42,
/* 0x02d0 */ 101,248,255, 52,163, 0, 1, 83,165,124, 1, 83, 99, 0, 3, 43,
/* 0x02d0 */ 101,248,255, 52,163, 0, 1, 83,165,124, 1, 19, 99, 0, 3, 43,
/* 0x02e0 */ 2, 0, 0, 20,226,255,255,151, 33, 0, 1, 58,224,255,255,151,
/* 0x02f0 */ 33, 0, 1, 58,225, 0, 0, 84, 33, 0,128, 82,220,255,255,151,
/* 0x0300 */ 33, 0, 1, 58,218,255,255,151,163,255,255, 84, 33, 8, 0, 17,

View File

@ -33,8 +33,8 @@
/* clang-format off */
#define STUB_ARM64_LINUX_ELF_ENTRY_SIZE 7437
#define STUB_ARM64_LINUX_ELF_ENTRY_ADLER32 0x1aee75c5
#define STUB_ARM64_LINUX_ELF_ENTRY_CRC32 0x63fb282c
#define STUB_ARM64_LINUX_ELF_ENTRY_ADLER32 0x90057585
#define STUB_ARM64_LINUX_ELF_ENTRY_CRC32 0x2ca610ba
unsigned char stub_arm64_linux_elf_entry[7437] = {
/* 0x0000 */ 127, 69, 76, 70, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@ -83,7 +83,7 @@ unsigned char stub_arm64_linux_elf_entry[7437] = {
/* 0x02b0 */ 241,255,255,151, 33, 0, 1, 58,239,255,255,151, 67,255,255, 84,
/* 0x02c0 */ 35, 12, 0,113, 1, 0,128, 82, 35, 1, 0, 84, 5, 20, 64, 56,
/* 0x02d0 */ 165, 32, 3, 42,229, 3, 37, 42,101,248,255, 52,163, 0, 1, 83,
/* 0x02e0 */ 165,124, 1, 83, 99, 0, 3, 43, 2, 0, 0, 20,226,255,255,151,
/* 0x02e0 */ 165,124, 1, 19, 99, 0, 3, 43, 2, 0, 0, 20,226,255,255,151,
/* 0x02f0 */ 33, 0, 1, 58,224,255,255,151, 33, 0, 1, 58,225, 0, 0, 84,
/* 0x0300 */ 33, 0,128, 82,220,255,255,151, 33, 0, 1, 58,218,255,255,151,
/* 0x0310 */ 163,255,255, 84, 33, 8, 0, 17, 33, 4, 0, 17,191, 0, 20, 49,

View File

@ -33,8 +33,8 @@
/* clang-format off */
#define STUB_ARM64_LINUX_ELF_SO_FOLD_SIZE 16470
#define STUB_ARM64_LINUX_ELF_SO_FOLD_ADLER32 0x5ca85f12
#define STUB_ARM64_LINUX_ELF_SO_FOLD_CRC32 0xc23c6836
#define STUB_ARM64_LINUX_ELF_SO_FOLD_ADLER32 0xa5255ed2
#define STUB_ARM64_LINUX_ELF_SO_FOLD_CRC32 0x6f40b8e7
unsigned char stub_arm64_linux_elf_so_fold[16470] = {
/* 0x0000 */ 127, 69, 76, 70, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@ -252,7 +252,7 @@ unsigned char stub_arm64_linux_elf_so_fold[16470] = {
/* 0x0d40 */ 243,255,255,151, 33, 0, 1, 58,241,255,255,151, 33, 0, 1, 58,
/* 0x0d50 */ 239,255,255,151, 67,255,255, 84, 35, 12, 0,113, 1, 0,128, 82,
/* 0x0d60 */ 35, 1, 0, 84, 5, 20, 64, 56,165, 32, 3, 42,229, 3, 37, 42,
/* 0x0d70 */ 101,248,255, 52,163, 0, 1, 83,165,124, 1, 83, 99, 0, 3, 43,
/* 0x0d70 */ 101,248,255, 52,163, 0, 1, 83,165,124, 1, 19, 99, 0, 3, 43,
/* 0x0d80 */ 2, 0, 0, 20,226,255,255,151, 33, 0, 1, 58,224,255,255,151,
/* 0x0d90 */ 33, 0, 1, 58,225, 0, 0, 84, 33, 0,128, 82,220,255,255,151,
/* 0x0da0 */ 33, 0, 1, 58,218,255,255,151,163,255,255, 84, 33, 8, 0, 17,

View File

@ -33,8 +33,8 @@
/* clang-format off */
#define STUB_ARM64_LINUX_SHLIB_INIT_SIZE 7923
#define STUB_ARM64_LINUX_SHLIB_INIT_ADLER32 0x74b92ff3
#define STUB_ARM64_LINUX_SHLIB_INIT_CRC32 0xfaebe7b3
#define STUB_ARM64_LINUX_SHLIB_INIT_ADLER32 0x70502fb3
#define STUB_ARM64_LINUX_SHLIB_INIT_CRC32 0x41670c6c
unsigned char stub_arm64_linux_shlib_init[7923] = {
/* 0x0000 */ 127, 69, 76, 70, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@ -83,7 +83,7 @@ unsigned char stub_arm64_linux_shlib_init[7923] = {
/* 0x02b0 */ 241,255,255,151, 33, 0, 1, 58,239,255,255,151, 67,255,255, 84,
/* 0x02c0 */ 35, 12, 0,113, 1, 0,128, 82, 35, 1, 0, 84, 5, 20, 64, 56,
/* 0x02d0 */ 165, 32, 3, 42,229, 3, 37, 42,101,248,255, 52,163, 0, 1, 83,
/* 0x02e0 */ 165,124, 1, 83, 99, 0, 3, 43, 2, 0, 0, 20,226,255,255,151,
/* 0x02e0 */ 165,124, 1, 19, 99, 0, 3, 43, 2, 0, 0, 20,226,255,255,151,
/* 0x02f0 */ 33, 0, 1, 58,224,255,255,151, 33, 0, 1, 58,225, 0, 0, 84,
/* 0x0300 */ 33, 0,128, 82,220,255,255,151, 33, 0, 1, 58,218,255,255,151,
/* 0x0310 */ 163,255,255, 84, 33, 8, 0, 17, 33, 4, 0, 17,191, 0, 20, 49,

View File

@ -33,8 +33,8 @@
/* clang-format off */
#define STUB_ARM64_WIN64_PE_SIZE 6445
#define STUB_ARM64_WIN64_PE_ADLER32 0x2ad96830
#define STUB_ARM64_WIN64_PE_CRC32 0x37da39bd
#define STUB_ARM64_WIN64_PE_ADLER32 0x85ff67f0
#define STUB_ARM64_WIN64_PE_CRC32 0xea750c60
unsigned char stub_arm64_win64_pe[6445] = {
/* 0x0000 */ 127, 69, 76, 70, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@ -78,7 +78,7 @@ unsigned char stub_arm64_win64_pe[6445] = {
/* 0x0260 */ 243,255,255,151, 33, 0, 1, 58,241,255,255,151, 33, 0, 1, 58,
/* 0x0270 */ 239,255,255,151, 67,255,255, 84, 35, 12, 0,113, 1, 0,128, 82,
/* 0x0280 */ 35, 1, 0, 84, 5, 20, 64, 56,165, 32, 3, 42,229, 3, 37, 42,
/* 0x0290 */ 101,248,255, 52,163, 0, 1, 83,165,124, 1, 83, 99, 0, 3, 43,
/* 0x0290 */ 101,248,255, 52,163, 0, 1, 83,165,124, 1, 19, 99, 0, 3, 43,
/* 0x02a0 */ 2, 0, 0, 20,226,255,255,151, 33, 0, 1, 58,224,255,255,151,
/* 0x02b0 */ 33, 0, 1, 58,225, 0, 0, 84, 33, 0,128, 82,220,255,255,151,
/* 0x02c0 */ 33, 0, 1, 58,218,255,255,151,163,255,255, 84, 33, 8, 0, 17,

View File

@ -157,7 +157,7 @@ getoff_n2d:
CHECK_SRC; LDRB3(off,[src],#1) // low 7+1 bits
orr off,off,tmp,lsl #8
mvn off,off; cbz off,eof_n2d // off= ~off
lsl tmp,off,#31; lsr off,off,#1; adds tmp,tmp,tmp
lsl tmp,off,#31; asr off,off,#1; adds tmp,tmp,tmp
b len_n2d -4 // CHEAT [getnextb ends in ADC2(reg,reg)]
offprev_n2d: