Don't try to load string table if strtab_link is SHN_UNDEF or the symbol table is empty

This commit is contained in:
Jeremy Rifkin 2025-01-28 22:21:43 -06:00
parent 18046688f6
commit 73ee7aa3a1
No known key found for this signature in database
GPG Key ID: 19AA8270105E8EB4

View File

@ -91,7 +91,11 @@ namespace detail {
std::string elf::lookup_symbol(frame_ptr pc) {
// TODO: Also search the SHT_DYNSYM at some point, maybe
auto symtab_ = get_symtab();
if(symtab_.is_error()) {
if(
symtab_.is_error()
|| symtab_.unwrap_value().strtab_link == SHN_UNDEF
|| symtab_.unwrap_value().entries.empty()
) {
return "";
}
auto& symtab = symtab_.unwrap_value();