From a68c62d938849516ecd880aa1c5e64883de8992d Mon Sep 17 00:00:00 2001 From: John Reiser Date: Mon, 30 May 2022 15:02:53 -0700 Subject: [PATCH] More placate compilers https://github.com/upx/upx/issues/577 modified: p_lx_elf.cpp --- src/p_lx_elf.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/p_lx_elf.cpp b/src/p_lx_elf.cpp index 77b73429..763cff96 100644 --- a/src/p_lx_elf.cpp +++ b/src/p_lx_elf.cpp @@ -5740,8 +5740,8 @@ PackLinuxElf64::invert_pt_dynamic(Elf64_Dyn const *dynp, upx_uint64_t headway) for (unsigned j = 0; j < n_off; ++j) { if (v_hsh == dt_offsets[j]) { if (dt_offsets[1+ j]) { - hashend = (unsigned const *)((dt_offsets[1+ j] - dt_offsets[j]) - + (void const *)hashtab); + hashend = (unsigned const *)(void const *) + ((dt_offsets[1+ j] - dt_offsets[j]) + (char const *)hashtab); } break; } @@ -5787,8 +5787,8 @@ PackLinuxElf64::invert_pt_dynamic(Elf64_Dyn const *dynp, upx_uint64_t headway) for (unsigned j = 0; j < n_off; ++j) { // linear search of short table if (v_gsh == dt_offsets[j]) { if (dt_offsets[1+ j]) { - gashend = (unsigned const *)((dt_offsets[1+ j] - dt_offsets[j]) - + (void const *)gashtab); + gashend = (unsigned const *)(void const *) + ((dt_offsets[1+ j] - dt_offsets[j]) + (char const *)gashtab); } break; } @@ -5858,7 +5858,8 @@ PackLinuxElf64::invert_pt_dynamic(Elf64_Dyn const *dynp, upx_uint64_t headway) } } if (sz_gshtab <= (file_size - off_gshtab)) { - gashend = (unsigned const *)(sz_gshtab + (void const *)gashtab); + gashend = (unsigned const *)(void const *) + (sz_gshtab + (char const *)gashtab); } }