[PATCH] D25516: [Object/ELF] - Check index argument in getSymbol().
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 20 01:12:36 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL284702: [Object/ELF] - Check index argument in getSymbol(). (authored by grimar).
Changed prior to commit:
https://reviews.llvm.org/D25516?vs=74383&id=75271#toc
Repository:
rL LLVM
https://reviews.llvm.org/D25516
Files:
llvm/trunk/include/llvm/Object/ELF.h
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<const Elf_Shdr *> 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<StringRef> getSectionName(const Elf_Shdr *Section) const;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25516.75271.patch
Type: text/x-patch
Size: 620 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161020/61e85ee3/attachment.bin>
More information about the llvm-commits
mailing list