[llvm-readobj] - Don't crash when dumping invalid dynamic relocation.
authorGeorgii Rymar <grimar@accesssoftek.com>
Tue, 28 Jan 2020 15:29:55 +0000 (18:29 +0300)
committerGeorgii Rymar <grimar@accesssoftek.com>
Fri, 31 Jan 2020 10:20:51 +0000 (13:20 +0300)
commit0654005ab2782a1294158ecfddd1337d8be7e3a4
treee8aed4bf2f9aed472bae1e0763ac0535719f7425
parent84695dd4d788dd65bb2b83ae1512a86c42109d7e
[llvm-readobj] - Don't crash when dumping invalid dynamic relocation.

Currently when we dump dynamic relocation with use of
DT_RELA/DT_RELASZ/DT_RELAENT tags, we crash when a symbol index
is larger than the number of dynamic symbols or
when there is no dynamic symbol table.

This patch adds test cases and fixes the issues.

Differential revision: https://reviews.llvm.org/D73560
llvm/test/tools/llvm-readobj/ELF/broken-dynamic-reloc.test
llvm/test/tools/llvm-readobj/ELF/dynamic-reloc-no-section-headers.test [new file with mode: 0644]
llvm/tools/llvm-readobj/ELFDumper.cpp