OSDN Git Service

[llvm-readelf] - --elf-hash-histogram: do not crash when the .gnu.hash goes past...
authorGeorgii Rymar <grimar@accesssoftek.com>
Tue, 19 May 2020 14:29:45 +0000 (17:29 +0300)
committerGeorgii Rymar <grimar@accesssoftek.com>
Fri, 29 May 2020 10:29:48 +0000 (13:29 +0300)
commitc68ee6da283c5697e935d1f9b7401c086cb18e03
tree0c3dd30aac593427685e23f9f688c65541e554a3
parent478f6fb2001698eb102ddce9500ff0885eaaeaab
[llvm-readelf] - --elf-hash-histogram: do not crash when the .gnu.hash goes past the EOF.

llvm-readelf might crash when the .gnu.hash table goes past the EOF.

This patch splits and updates the code of a helper function `checkGNUHashTable`,
which is similar to `checkHashTable` and fixes the issue.

Differential revision: https://reviews.llvm.org/D80215
llvm/test/tools/llvm-readobj/ELF/gnuhash.test
llvm/test/tools/llvm-readobj/ELF/hash-histogram.test
llvm/tools/llvm-readobj/ELFDumper.cpp