[all-commits] [llvm/llvm-project] 88c858: [llvm-readobj] - Do not crash when GnuHashTable->s...
Georgii Rymar via All-commits
all-commits at lists.llvm.org
Wed Jun 17 04:27:13 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 88c8581d9fe449f07781ff8abedf598b9410e727
https://github.com/llvm/llvm-project/commit/88c8581d9fe449f07781ff8abedf598b9410e727
Author: Georgii Rymar <grimar at accesssoftek.com>
Date: 2020-06-17 (Wed, 17 Jun 2020)
Changed paths:
M llvm/include/llvm/Object/ELFTypes.h
M llvm/test/tools/llvm-readobj/ELF/gnuhash.test
M llvm/test/tools/llvm-readobj/ELF/hash-histogram.test
M llvm/tools/llvm-readobj/ELFDumper.cpp
Log Message:
-----------
[llvm-readobj] - Do not crash when GnuHashTable->symndx is greater than the dynamic symbols count.
`Elf_GnuHash_Impl` has the following method:
```
ArrayRef<Elf_Word> values(unsigned DynamicSymCount) const {
return ArrayRef<Elf_Word>(buckets().end(), DynamicSymCount - symndx);
}
```
When DynamicSymCount is less than symndx we return an array with the huge broken size.
This patch fixes the issue and adds an assert. This assert helped to fix an issue
in one of the test cases.
Differential revision: https://reviews.llvm.org/D81937
More information about the All-commits
mailing list