[llvm-readobj] - --gnu-hash-table: do not crash when the GNU hash table goes past...
authorGeorgii Rymar <grimar@accesssoftek.com>
Wed, 13 May 2020 12:06:01 +0000 (15:06 +0300)
committerGeorgii Rymar <grimar@accesssoftek.com>
Fri, 15 May 2020 08:33:23 +0000 (11:33 +0300)
commit56970ec6a0bed5ba4312872eed13137ca43f67fb
treeef96ff16170f312e725f5ea60f9a37b1482074ed
parent7ccae2cece72153d2c8210ef916bf0052da216ad
[llvm-readobj] - --gnu-hash-table: do not crash when the GNU hash table goes past the EOF.

We might have a scenario where a the `GbuHashTable` variable correctly points
to a place inside the file (we validate this fact early in `parseDynamicTable`),
but nbuckets/maskwords fields are broken in the way the code tries
to read the data past the EOF. This patch fixes the issue.

Differential revision: https://reviews.llvm.org/D79853
llvm/test/tools/llvm-readobj/ELF/gnuhash.test
llvm/tools/llvm-readobj/ELFDumper.cpp
llvm/tools/llvm-readobj/ObjDumper.h
llvm/tools/llvm-readobj/llvm-readobj.cpp