aboutsummaryrefslogtreecommitdiff
path: root/test/Object/corrupt.test
blob: 9cbe9ef5e0896e1da6c9b96fee12b935ea0cdc45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Section name offset overflows section name string table.
RUN: not llvm-readobj %p/Inputs/corrupt.elf-x86-64 -sections \
RUN:     2>&1 | FileCheck --check-prefix=SECNAME %s

SECNAME: invalid string offset


// Section data offset past end of file.
RUN: not llvm-readobj %p/Inputs/corrupt.elf-x86-64 -sections -section-data \
RUN:     2>&1 | FileCheck --check-prefix=SECDATA %s

SECDATA: invalid section offset


// Symbol name offset overflows string table.
RUN: not llvm-readobj %p/Inputs/corrupt.elf-x86-64 -symbols \
RUN:     2>&1 | FileCheck --check-prefix=SYMNAME %s

SYMNAME: invalid string offset


// Version index in .gnu.version overflows the version map.
RUN: not llvm-readobj %p/Inputs/corrupt-version.elf-x86_64 -dt \
RUN:     2>&1 | FileCheck --check-prefix=VER %s

VER: Error reading file: Invalid version entry.


// The file is missing the dynamic string table but has references to it.
RUN: not llvm-readobj -dynamic-table %p/Inputs/corrupt-invalid-strtab.elf.x86-64 \
RUN:     2>&1 | FileCheck --check-prefix=STRTAB %s

STRTAB: Invalid dynamic string table reference

RUN: not llvm-readobj -program-headers \
RUN:   %p/Inputs/corrupt-invalid-phentsize.elf.x86-64 2>&1 | \
RUN:   FileCheck --check-prefix=PHENTSIZE %s

PHENTSIZE: invalid e_phentsize

RUN: not llvm-readobj -dynamic-table \
RUN:   %p/Inputs/corrupt-invalid-virtual-addr.elf.x86-64 2>&1 | \
RUN:   FileCheck --check-prefix=VIRTADDR %s

VIRTADDR: Virtual address is not in any segment


RUN: not llvm-readobj -dyn-relocations \
RUN:   %p/Inputs/corrupt-invalid-relocation-size.elf.x86-64 2>&1 | \
RUN:   FileCheck --check-prefix=RELOC %s

RELOC:  Invalid entity size

RUN: not llvm-readobj -dyn-relocations \
RUN:   %p/Inputs/corrupt-invalid-dynamic-table-size.elf.x86-64 2>&1 | \
RUN:   FileCheck --check-prefix=DYN-TABLE-SIZE %s

DYN-TABLE-SIZE:  Invalid entity size


RUN: not llvm-readobj -dyn-relocations \
RUN:   %p/Inputs/corrupt-invalid-dynamic-table-offset.elf.x86-64 2>&1 | \
RUN:   FileCheck --check-prefix=DYN-TABLE-OFFSET %s

DYN-TABLE-OFFSET: Invalid data was encountered while parsing the file.


RUN: not llvm-readobj -dyn-relocations \
RUN:   %p/Inputs/corrupt-invalid-dynamic-table-too-large.elf.x86-64 2>&1 | \
RUN:   FileCheck --check-prefix=DYN-TABLE-TOO-LARGE %s

DYN-TABLE-TOO-LARGE: Invalid data was encountered while parsing the file.