mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
[llvm-readelf] - Do not crash when dumping the dynamic symbol table when its sh_entzize == 0.
We have a division by zero crash currently when the sh_entzize of the dynamic symbol table is 0. Differential revision: https://reviews.llvm.org/D82180
This commit is contained in:
parent
b59dba09e0
commit
9502f97d8b
@ -490,3 +490,26 @@ ProgramHeaders:
|
||||
Sections:
|
||||
- Section: .dynstr
|
||||
- Section: .dynamic
|
||||
|
||||
## Check we report a warning when the entry size of the dynamic symbol table is zero.
|
||||
# RUN: yaml2obj %s --docnum=14 -o %t15
|
||||
# RUN: llvm-readobj --dyn-symbols %t15 2>&1 | FileCheck %s -DFILE=%t15 --check-prefix=DYNSYM-ZERO-ENTSIZE-LLVM
|
||||
# RUN: llvm-readelf --dyn-symbols %t15 2>&1 | \
|
||||
# RUN: FileCheck %s -DFILE=%t15 --check-prefix=DYNSYM-ZERO-ENTSIZE-GNU --implicit-check-not="Symbol table"
|
||||
|
||||
# DYNSYM-ZERO-ENTSIZE-LLVM: DynamicSymbols [
|
||||
# DYNSYM-ZERO-ENTSIZE-LLVM-NEXT: warning: '[[FILE]]': section with index 1 has invalid size (0x10) or entry size (0x0)
|
||||
# DYNSYM-ZERO-ENTSIZE-LLVM-NEXT: ]
|
||||
|
||||
# DYNSYM-ZERO-ENTSIZE-GNU: warning: '[[FILE]]': section with index 1 has invalid size (0x10) or entry size (0x0)
|
||||
|
||||
--- !ELF
|
||||
FileHeader:
|
||||
Class: ELFCLASS32
|
||||
Data: ELFDATA2LSB
|
||||
Type: ET_DYN
|
||||
Machine: EM_386
|
||||
Sections:
|
||||
- Name: .dynsym
|
||||
Type: SHT_DYNSYM
|
||||
EntSize: 0x0
|
||||
|
@ -678,8 +678,7 @@ void ELFDumper<ELFT>::printSymbolsHelper(bool IsDynamic) const {
|
||||
StrTable = DynamicStringTable;
|
||||
Syms = dynamic_symbols();
|
||||
SymtabName = DynSymtabName;
|
||||
if (DynSymRegion)
|
||||
Entries = DynSymRegion->Size / DynSymRegion->EntSize;
|
||||
Entries = Syms.size();
|
||||
} else {
|
||||
if (!DotSymtabSec)
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user