diff --git a/src/common/linux/elfutils.cc b/src/common/linux/elfutils.cc index ce9e9c1c..aa95357a 100644 --- a/src/common/linux/elfutils.cc +++ b/src/common/linux/elfutils.cc @@ -57,6 +57,12 @@ void FindElfClassSection(const char* elf_base, const Ehdr* elf_header = reinterpret_cast(elf_base); assert(elf_header->e_ident[EI_CLASS] == ElfClass::kClass); + if (elf_header->e_shoff == 0) { + *section_start = NULL; + *section_size = 0; + return; + } + const Shdr* sections = GetOffset(elf_header, elf_header->e_shoff); const Shdr* section_names = sections + elf_header->e_shstrndx;