aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/common/linux/elfutils.cc6
1 files changed, 6 insertions, 0 deletions
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<const Ehdr*>(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<ElfClass, Shdr>(elf_header, elf_header->e_shoff);
const Shdr* section_names = sections + elf_header->e_shstrndx;