1// No crash, might not be totally invalid
2RUN: llvm-objdump -private-headers %p/Inputs/macho-invalid-zero-ncmds
3
4RUN: not llvm-objdump -private-headers %p/Inputs/macho64-invalid-incomplete-load-command 2>&1 \
5RUN:      | FileCheck -check-prefix INCOMPLETE-LOADC %s
6
7RUN: not llvm-objdump -private-headers %p/Inputs/macho-invalid-too-small-load-command 2>&1 \
8RUN:      | FileCheck -check-prefix SMALL-LOADC-SIZE %s
9RUN: not llvm-objdump -private-headers %p/Inputs/macho64-invalid-too-small-load-command 2>&1 \
10RUN:      | FileCheck -check-prefix SMALL-LOADC-SIZE %s
11
12RUN: not llvm-objdump -private-headers %p/Inputs/macho-invalid-too-small-segment-load-command 2>&1 \
13RUN:      | FileCheck -check-prefix SMALL-SEGLOADC-SIZE %s
14RUN: not llvm-objdump -private-headers %p/Inputs/macho64-invalid-too-small-segment-load-command 2>&1 \
15RUN:      | FileCheck -check-prefix SMALL-SEGLOADC-SIZE %s
16
17RUN: not llvm-objdump -private-headers %p/Inputs/macho-invalid-no-size-for-sections 2>&1 \
18RUN:      | FileCheck -check-prefix TOO-MANY-SECTS %s
19RUN: not llvm-objdump -private-headers %p/Inputs/macho64-invalid-no-size-for-sections 2>&1 \
20RUN:      | FileCheck -check-prefix TOO-MANY-SECTS %s
21
22RUN: not llvm-objdump -t %p/Inputs/macho-invalid-bad-symbol-index 2>&1 \
23RUN:      | FileCheck -check-prefix BAD-SYMBOL %s
24
25RUN: not llvm-objdump -t %p/Inputs/macho-invalid-symbol-name-past-eof 2>&1 \
26RUN:      | FileCheck -check-prefix NAME-PAST-EOF %s
27
28RUN: not llvm-objdump -t %p/Inputs/macho-invalid-section-index-getSectionRawFinalSegmentName 2>&1 \
29RUN:      | FileCheck -check-prefix INVALID-SECTION-IDX-SEG-NAME %s
30
31RUN: not llvm-nm %p/Inputs/macho-invalid-section-index-getSectionRawName 2>&1 \
32RUN:      | FileCheck -check-prefix INVALID-SECTION-IDX-SECT-NAME %s
33
34RUN: not llvm-objdump -t %p/Inputs/macho-invalid-getsection-index 2>&1 \
35RUN:      | FileCheck -check-prefix INVALID-SECTION-IDX-GETSECT %s
36
37RUN: not llvm-objdump -t %p/Inputs/macho64-invalid-getsection-index 2>&1 \
38RUN:      | FileCheck -check-prefix INVALID-SECTION-IDX-GETSECT64 %s
39
40
41SMALL-LOADC-SIZE: Load command with size < 8 bytes
42SMALL-SEGLOADC-SIZE: Segment load command size is too small
43INCOMPLETE-LOADC: Malformed MachO file
44TOO-MANY-SECTS: Number of sections too large for size of load command
45BAD-SYMBOL: Requested symbol index is out of range
46NAME-PAST-EOF: Symbol name entry points before beginning or past end of file
47
48INVALID-SECTION-IDX-SEG-NAME: getSectionRawFinalSegmentName: Invalid section index
49INVALID-SECTION-IDX-SECT-NAME: getSectionRawName: Invalid section index
50INVALID-SECTION-IDX-GETSECT: getSection: Invalid section index
51INVALID-SECTION-IDX-GETSECT64: getSection64: Invalid section index
52