[llvm-readobj] - Don't crash when relocation table goes past the EOF.
authorGeorgii Rymar <grimar@accesssoftek.com>
Thu, 19 Nov 2020 09:18:18 +0000 (12:18 +0300)
committerGeorgii Rymar <grimar@accesssoftek.com>
Mon, 23 Nov 2020 07:31:04 +0000 (10:31 +0300)
commit2584e1e324c97eeeacc1e421e5f3191a708c3d2d
tree3ba1e8884854f88870a970d18b35861efa25fe61
parent47e31d1b5eac6a7b69a50404ecdc35daf18c01f9
[llvm-readobj] - Don't crash when relocation table goes past the EOF.

It is possible to trigger reading past the EOF by breaking fields like
DT_PLTRELSZ, DT_RELSZ or DT_RELASZ

This patch adds a validation in `DynRegionInfo` helper class.

Differential revision: https://reviews.llvm.org/D91787
llvm/test/tools/llvm-readobj/ELF/broken-dynamic-reloc.test
llvm/tools/llvm-readobj/ELFDumper.cpp