[PATCH] D93209: [libObject, llvm-readobj] - Reimplement `ELFFile<ELFT>::getEntry`.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 14 06:20:53 PST 2020
grimar created this revision.
grimar added reviewers: jhenderson, MaskRay.
Herald added subscribers: rupprecht, emaste.
Herald added a reviewer: espindola.
grimar requested review of this revision.
Herald added a project: LLVM.
Currently, `ELFFile<ELFT>::getEntry` does not check an index of
an entry. Because of that the code might read past the end of the symbol
table silently. I've added a test to `llvm-readobj\ELF\relocations.test`
to demonstrate the possible issue. Also, I've added a unit test for
this method.
After this change, `getEntry` stops reporting the section index and
reuses the `getSectionContentsAsArray` method, which already has
all the validation needed. Our related warnings now provide
more and better context sometimes.
https://reviews.llvm.org/D93209
Files:
lld/test/ELF/invalid/dynamic-section-broken.test
llvm/include/llvm/Object/ELF.h
llvm/include/llvm/Object/ELFObjectFile.h
llvm/test/Object/invalid.test
llvm/test/tools/llvm-nm/invalid-symbol-table-size.test
llvm/test/tools/llvm-objdump/invalid-symbol-table-size.test
llvm/test/tools/llvm-readobj/ELF/call-graph-profile.test
llvm/test/tools/llvm-readobj/ELF/reloc-symbol-with-versioning.test
llvm/test/tools/llvm-readobj/ELF/relocation-errors.test
llvm/test/tools/llvm-readobj/ELF/relocations.test
llvm/test/tools/llvm-readobj/ELF/relr-relocs.test
llvm/test/tools/llvm-readobj/ELF/stack-sizes.test
llvm/test/tools/llvm-readobj/ELF/symbols.test
llvm/test/tools/llvm-readobj/ELF/versym-invalid.test
llvm/test/tools/llvm-size/invalid-symbol-table-size.test
llvm/test/tools/obj2yaml/ELF/dynamic-section.yaml
llvm/test/tools/obj2yaml/ELF/rel-rela-section.yaml
llvm/test/tools/yaml2obj/ELF/sht-symtab-shndx.yaml
llvm/tools/llvm-readobj/ELFDumper.cpp
llvm/unittests/Object/ELFObjectFileTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93209.311564.patch
Type: text/x-patch
Size: 36726 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201214/cb5d30ce/attachment.bin>
More information about the llvm-commits
mailing list