diff --git a/src/emucore/elf/ElfParser.cxx b/src/emucore/elf/ElfParser.cxx index 5a6e551ad..9e90c2799 100644 --- a/src/emucore/elf/ElfParser.cxx +++ b/src/emucore/elf/ElfParser.cxx @@ -175,10 +175,19 @@ const ElfParser::Section* ElfParser::getSymtab() const const ElfParser::Section* ElfParser::getStrtab() const { - for (size_t i = 0; i < sections.size(); i++) - if (sections[i].type == SHT_STRTAB && i != header.shstrIndex) return §ions[i]; + const Section* strtab = nullptr; + size_t count = 0; - return nullptr; + for (size_t i = 0; i < sections.size(); i++) { + if (sections[i].type != SHT_STRTAB || i == header.shstrIndex) continue; + + strtab = §ions[i]; + count++; + } + + if (count > 1) EInvalidElf::raise("more than one symbol table"); + + return strtab; } ostream& operator<<(ostream& os, const ElfParser::Section& section) diff --git a/src/emucore/elf/ElfParser.hxx b/src/emucore/elf/ElfParser.hxx index 3b93fa3d7..d510f5de8 100644 --- a/src/emucore/elf/ElfParser.hxx +++ b/src/emucore/elf/ElfParser.hxx @@ -135,7 +135,6 @@ class ElfParser { }; ostream& operator<<(ostream& os, const ElfParser::Section& section); - ostream& operator<<(ostream& os, const ElfParser::Symbol symbol); #endif // ELF_PARSER