git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285803
91177308-0d34-0410-b5e6-
96231b3b80d8
if (Index >= getNumSections())
return object_error::invalid_section_index;
- const uint8_t *Addr = reinterpret_cast<const uint8_t *>(SectionHeaderTable) +
- (Index * Header->e_shentsize);
- if (Addr >= base() + getBufSize())
+ const Elf_Shdr *Addr = SectionHeaderTable + Index;
+ if (reinterpret_cast<const uint8_t *>(Addr) >= base() + getBufSize())
return object_error::invalid_section_index;
- return reinterpret_cast<const Elf_Shdr *>(Addr);
+ return Addr;
}
template <class ELFT>