[all-commits] [llvm/llvm-project] 8590b5: [libObject, llvm-readobj] - Reimplement `ELFFile<E...

Georgii Rymar via All-commits all-commits at lists.llvm.org
Fri Dec 18 05:53:12 PST 2020


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8590b5ccd568764287ec5ed28567d0284ab9dbdb
      https://github.com/llvm/llvm-project/commit/8590b5ccd568764287ec5ed28567d0284ab9dbdb
  Author: Georgii Rymar <grimar at accesssoftek.com>
  Date:   2020-12-18 (Fri, 18 Dec 2020)

  Changed paths:
    M lld/test/ELF/invalid/dynamic-section-broken.test
    M llvm/include/llvm/Object/ELF.h
    M llvm/test/Object/invalid.test
    M llvm/test/tools/llvm-readobj/ELF/call-graph-profile.test
    M llvm/test/tools/llvm-readobj/ELF/reloc-symbol-with-versioning.test
    M llvm/test/tools/llvm-readobj/ELF/relocation-errors.test
    M llvm/test/tools/llvm-readobj/ELF/relocations.test
    M llvm/test/tools/llvm-readobj/ELF/relr-relocs.test
    M llvm/test/tools/llvm-readobj/ELF/stack-sizes.test
    M llvm/test/tools/llvm-readobj/ELF/symbols.test
    M llvm/test/tools/llvm-readobj/ELF/versym-invalid.test
    M llvm/test/tools/obj2yaml/ELF/dynamic-section.yaml
    M llvm/test/tools/obj2yaml/ELF/rel-rela-section.yaml
    M llvm/test/tools/yaml2obj/ELF/sht-symtab-shndx.yaml
    M llvm/tools/llvm-readobj/ELFDumper.cpp
    M llvm/unittests/Object/ELFObjectFileTest.cpp

  Log Message:
  -----------
  [libObject, llvm-readobj] - Reimplement `ELFFile<ELFT>::getEntry`.

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.

Differential revision: https://reviews.llvm.org/D93209




More information about the All-commits mailing list