1
0
mirror of https://github.com/upx/upx synced 2025-10-05 19:20:23 +08:00

invert_pt_dynamic: Compilers differ, unsigned vs. signed

modified:   p_lx_elf.cpp
This commit is contained in:
John Reiser 2024-01-10 10:33:33 -08:00 committed by Markus F.X.J. Oberhumer
parent 6dde9f7dc0
commit 553fc9b1fb

View File

@ -2128,7 +2128,7 @@ PackLinuxElf32::invert_pt_dynamic(Elf32_Dyn const *dynp, u32_t headway)
unsigned const *const chains = &buckets[nbucket]; (void)chains; unsigned const *const chains = &buckets[nbucket]; (void)chains;
unsigned const v_sym = !x_sym ? 0 : get_te32(&dynp0[-1+ x_sym].d_val); unsigned const v_sym = !x_sym ? 0 : get_te32(&dynp0[-1+ x_sym].d_val);
if ((hashend - buckets) < nbucket if ((unsigned)(hashend - buckets) < nbucket
|| !v_sym || (unsigned)file_size <= v_sym || !v_sym || (unsigned)file_size <= v_sym
|| ((v_hsh < v_sym) && (v_sym - v_hsh) < sizeof(*buckets)*(2+ nbucket)) || ((v_hsh < v_sym) && (v_sym - v_hsh) < sizeof(*buckets)*(2+ nbucket))
) { ) {
@ -2170,7 +2170,7 @@ PackLinuxElf32::invert_pt_dynamic(Elf32_Dyn const *dynp, u32_t headway)
unsigned const *const buckets = (unsigned const *)&bitmask[n_bitmask]; unsigned const *const buckets = (unsigned const *)&bitmask[n_bitmask];
unsigned const *const hasharr = &buckets[n_bucket]; (void)hasharr; unsigned const *const hasharr = &buckets[n_bucket]; (void)hasharr;
if (!n_bucket || (1u<<31) <= n_bucket /* fie on fuzzers */ if (!n_bucket || (1u<<31) <= n_bucket /* fie on fuzzers */
|| (gashend - buckets) < n_bucket || (unsigned)(gashend - buckets) < n_bucket
|| (void const *)&file_image[file_size] <= (void const *)hasharr) { || (void const *)&file_image[file_size] <= (void const *)hasharr) {
char msg[80]; snprintf(msg, sizeof(msg), char msg[80]; snprintf(msg, sizeof(msg),
"bad n_bucket %#x\n", n_bucket); "bad n_bucket %#x\n", n_bucket);
@ -8015,7 +8015,7 @@ PackLinuxElf64::invert_pt_dynamic(Elf64_Dyn const *dynp, upx_uint64_t headway)
unsigned const *const chains = &buckets[nbucket]; (void)chains; unsigned const *const chains = &buckets[nbucket]; (void)chains;
unsigned const v_sym = !x_sym ? 0 : get_te64(&dynp0[-1+ x_sym].d_val); // UPX_RSIZE_MAX_MEM unsigned const v_sym = !x_sym ? 0 : get_te64(&dynp0[-1+ x_sym].d_val); // UPX_RSIZE_MAX_MEM
if ((hashend - buckets) < nbucket if ((unsigned)(hashend - buckets) < nbucket
|| !v_sym || (unsigned)file_size <= v_sym || !v_sym || (unsigned)file_size <= v_sym
|| ((v_hsh < v_sym) && (v_sym - v_hsh) < sizeof(*buckets)*(2+ nbucket)) || ((v_hsh < v_sym) && (v_sym - v_hsh) < sizeof(*buckets)*(2+ nbucket))
) { ) {
@ -8057,7 +8057,7 @@ PackLinuxElf64::invert_pt_dynamic(Elf64_Dyn const *dynp, upx_uint64_t headway)
unsigned const *const buckets = (unsigned const *)&bitmask[n_bitmask]; unsigned const *const buckets = (unsigned const *)&bitmask[n_bitmask];
unsigned const *const hasharr = &buckets[n_bucket]; (void)hasharr; unsigned const *const hasharr = &buckets[n_bucket]; (void)hasharr;
if (!n_bucket || (1u<<31) <= n_bucket /* fie on fuzzers */ if (!n_bucket || (1u<<31) <= n_bucket /* fie on fuzzers */
|| (gashend - buckets) < n_bucket || (unsigned)(gashend - buckets) < n_bucket
|| (void const *)&file_image[file_size] <= (void const *)hasharr) { || (void const *)&file_image[file_size] <= (void const *)hasharr) {
char msg[80]; snprintf(msg, sizeof(msg), char msg[80]; snprintf(msg, sizeof(msg),
"bad n_bucket %#x\n", n_bucket); "bad n_bucket %#x\n", n_bucket);