Index: ELF.h =================================================================== --- ELF.h +++ ELF.h @@ -356,6 +356,10 @@ return; } + if (Header->e_shentsize != sizeof(Elf_Shdr)) + report_fatal_error( + "Invalid section header entry size (e_shentsize) in ELF header"); + // The getNumSections() call below depends on SectionHeaderTable being set. SectionHeaderTable = reinterpret_cast(base() + SectionTableOffset); @@ -390,9 +394,6 @@ template const typename ELFFile::Elf_Shdr *ELFFile::section_begin() const { - if (Header->e_shentsize != sizeof(Elf_Shdr)) - report_fatal_error( - "Invalid section header entry size (e_shentsize) in ELF header"); return reinterpret_cast(base() + Header->e_shoff); }