[PATCH] D86923: [llvm-readobj/elf] - Don't crash when the size of s dynamic symbol table, inferred from the hash table, is broken.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 1 03:16:43 PDT 2020


grimar created this revision.
grimar added reviewers: jhenderson, MaskRay.
Herald added subscribers: rupprecht, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
grimar requested review of this revision.

Currently we might derive the dynamic symbol table size from the DT_HASH hash table (using its `nchain` field).
It is possible to crash dumpers with a broken relocation that refers to a symbol with an index
that is too large. To trigger it, the inferred size of the dynamic symbol table should go past the end of the object.

This patch adds a size validation + warning.


https://reviews.llvm.org/D86923

Files:
  llvm/test/tools/llvm-readobj/ELF/dyn-symbols-size-from-hash-table.test
  llvm/test/tools/llvm-readobj/ELF/hash-histogram.test
  llvm/test/tools/llvm-readobj/ELF/hash-symbols.test
  llvm/test/tools/llvm-readobj/ELF/hash-table.test
  llvm/tools/llvm-readobj/ELFDumper.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86923.289115.patch
Type: text/x-patch
Size: 8031 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200901/382e7b5e/attachment.bin>


More information about the llvm-commits mailing list