Fix #16266 - Fix two warnings (#16426)

This commit is contained in:
pancake 2020-04-06 12:39:51 -04:00 committed by GitHub
parent 5c31876093
commit e484762fe0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -3304,9 +3304,8 @@ static bool is_section_local_sym(ELFOBJ *bin, Elf_(Sym) *sym) {
if (!is_shidx_valid (bin, sym->st_shndx)) {
return false;
}
Elf_(Word) sh_name = bin->shdr[sym->st_shndx].sh_name;
return bin->shstrtab && sh_name >= 0 && sh_name < bin->shstrtab_size;
return bin->shstrtab && sh_name < bin->shstrtab_size;
}
static void setsymord(ELFOBJ* eobj, ut32 ord, RBinSymbol *ptr) {

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2010-2019 - nibble, pancake */
/* radare - LGPL - Copyright 2010-2020 - nibble, pancake */
#include <stdio.h>
#include <r_types.h>
@ -3020,7 +3020,7 @@ RSkipList *MACH0_(get_relocs)(struct MACH0_(obj_t) *bin) {
return NULL;
}
ut64 amount = bind_size + lazy_size + weak_size;
if (amount < 0) {
if (amount == 0 || amount > UT32_MAX) {
return NULL;
}
relocs = r_skiplist_new ((RListFree) &free, (RListComparator) &reloc_comparator);