MSVC strikes again

modified:   p_lx_elf.cpp
This commit is contained in:
John Reiser 2020-09-05 19:19:11 -07:00 committed by Markus F.X.J. Oberhumer
parent be61e9f584
commit e6ccef2cf1

View File

@ -1683,7 +1683,7 @@ PackLinuxElf32::invert_pt_dynamic(Elf32_Dyn const *dynp, unsigned dt_filesz)
unsigned const *const chains = &buckets[nbucket]; (void)chains;
unsigned const v_sym = !x_sym ? 0 : get_te32(&dynp0[-1+ x_sym].d_val);
if (!nbucket || (nbucket>>31) || !v_sym || file_size <= v_sym
if (!nbucket || (nbucket>>31) || !v_sym || (unsigned)file_size <= v_sym
|| ((v_hsh < v_sym) && (v_sym - v_hsh) < sizeof(*buckets)*(2+ nbucket))
) {
char msg[80]; snprintf(msg, sizeof(msg),
@ -5298,7 +5298,7 @@ PackLinuxElf64::invert_pt_dynamic(Elf64_Dyn const *dynp, upx_uint64_t dt_filesz)
unsigned const *const chains = &buckets[nbucket]; (void)chains;
unsigned const v_sym = !x_sym ? 0 : get_te32(&dynp0[-1+ x_sym].d_val);
if (!nbucket || (nbucket>>31) || !v_sym || file_size <= v_sym
if (!nbucket || (nbucket>>31) || !v_sym || (unsigned)file_size <= v_sym
|| ((v_hsh < v_sym) && (v_sym - v_hsh) < sizeof(*buckets)*(2+ nbucket))
) {
char msg[80]; snprintf(msg, sizeof(msg),