Skip to content

Commit

Permalink
skip symbols with undefined section index
Browse files Browse the repository at this point in the history
  • Loading branch information
rdbo committed Apr 11, 2024
1 parent 911ac4e commit 42cc87b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/elfutils/elfutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ enum_elf##elf_type##_symbols(FILE *elf, uint64_t base_address, int (*callback)(c
if (fread(&sym, sizeof(sym), 1, elf) == 0) \
goto STRTAB_EXIT; \
\
if (sym.st_name == 0 || ELFW_ST_TYPE(sym) == STT_FILE) \
if (sym.st_name == 0 || ELFW_ST_TYPE(sym) == STT_FILE || sym.st_shndx == 0) \
continue; \
\
symbol_name = &strtab[sym.st_name]; \
Expand Down Expand Up @@ -125,7 +125,7 @@ enum_elf##elf_type##_symbols(FILE *elf, uint64_t base_address, int (*callback)(c
if (fread(&sym, sizeof(sym), 1, elf) == 0) \
goto DYNSTR_EXIT; \
\
if (sym.st_name == 0 || ELFW_ST_TYPE(sym) == STT_FILE) \
if (sym.st_name == 0 || ELFW_ST_TYPE(sym) == STT_FILE || sym.st_shndx == 0) \
continue; \
\
symbol_name = &dynstr[sym.st_name]; \
Expand Down

0 comments on commit 42cc87b

Please sign in to comment.