lib: clippy ELF: check existence of string table

Mostly to make coverity happy, no compiler/linker should produce broken
ELF files like this (and if it does we can't process it anyway...)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
David Lamparter 2023-09-20 14:49:22 +02:00
parent e408a915a3
commit 592011b251

View file

@ -1089,7 +1089,9 @@ static void elffile_add_dynreloc(struct elffile *w, Elf_Data *reldata,
symidx = relw->symidx = GELF_R_SYM(rela->r_info);
sym = relw->sym = gelf_getsym(symdata, symidx, &relw->_sym);
if (sym) {
relw->symname = elfdata_strptr(strdata, sym->st_name);
if (strdata)
relw->symname = elfdata_strptr(strdata,
sym->st_name);
relw->symvalid = GELF_ST_TYPE(sym->st_info)
!= STT_NOTYPE;
relw->unresolved = sym->st_shndx == SHN_UNDEF;