From 73ee7aa3a108dfa617cd70d3d4c5a0698ed8c7e2 Mon Sep 17 00:00:00 2001 From: Jeremy Rifkin <51220084+jeremy-rifkin@users.noreply.github.com> Date: Tue, 28 Jan 2025 22:21:43 -0600 Subject: [PATCH] Don't try to load string table if strtab_link is SHN_UNDEF or the symbol table is empty --- src/binary/elf.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/binary/elf.cpp b/src/binary/elf.cpp index 62f1f0f..173ba2b 100644 --- a/src/binary/elf.cpp +++ b/src/binary/elf.cpp @@ -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();