1
1
mirror of https://github.com/rui314/mold.git synced 2024-11-12 23:48:51 +03:00

Merge pull request #809 from sicherha/fix_SHN_XINDEX_out_of_bounds

Fix name lookup for section symbols when `st_shndx == SHN_XINDEX`
This commit is contained in:
Rui Ueyama 2022-10-22 18:15:55 -07:00 committed by GitHub
commit f9750d163d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -446,7 +446,7 @@ void ObjectFile<E>::initialize_symbols(Context<E> &ctx) {
std::string_view name;
if (esym.st_type == STT_SECTION)
name = this->shstrtab.data() + this->elf_sections[esym.st_shndx].sh_name;
name = this->shstrtab.data() + this->elf_sections[get_shndx(esym)].sh_name;
else
name = this->symbol_strtab.data() + esym.st_name;