Index: llvm/trunk/include/llvm/Object/ELF.h =================================================================== --- llvm/trunk/include/llvm/Object/ELF.h +++ llvm/trunk/include/llvm/Object/ELF.h @@ -168,7 +168,10 @@ ErrorOr getSection(uint32_t Index) const; const Elf_Sym *getSymbol(const Elf_Shdr *Sec, uint32_t Index) const { - return &symbols(Sec)[Index]; + Elf_Sym_Range Symbols = symbols(Sec); + if (Index >= Symbols.size()) + report_fatal_error("Invalid symbol index"); + return &Symbols[Index]; } ErrorOr getSectionName(const Elf_Shdr *Section) const;