blob: 499c23e09d21da7147032a6bf79dff0b6a8659cb [file] [log] [blame]
Kevin Enderbya59824a2015-10-06 22:27:08 +00001// These test checks that llvm-objdump will not crash with malformed Mach-O
2// files. So the check line is not all that important but the bug fixes to
3// make sure llvm-objdump is robust is what matters.
Kevin Enderbyc614d282016-08-12 20:10:25 +00004# RUN: not llvm-objdump -macho -objc-meta-data \
5# RUN: %p/Inputs/malformed-machos/mem-crup-0001.macho 2>&1 \
Kevin Enderbya59824a2015-10-06 22:27:08 +00006# RUN: | FileCheck -check-prefix=m0001 %s
7
Kevin Enderbyc614d282016-08-12 20:10:25 +00008# m0001: mem-crup-0001.macho': truncated or malformed object (addr field plus size of section 2 in LC_SEGMENT_64 command 0 greater than than the segment's vmaddr plus vmsize)
Kevin Enderbya59824a2015-10-06 22:27:08 +00009
Kevin Enderbyfbebe162016-11-02 21:08:39 +000010# RUN: not llvm-objdump -macho -objc-meta-data \
11# RUN: %p/Inputs/malformed-machos/mem-crup-0006.macho 2>&1 \
Kevin Enderbya59824a2015-10-06 22:27:08 +000012# RUN: | FileCheck -check-prefix=m0006 %s
13
Kevin Enderbyfbebe162016-11-02 21:08:39 +000014# m0006: malformed-machos/mem-crup-0006.macho': truncated or malformed object (section contents at offset 4128 with a size of 176, overlaps section contents at offset 4128 with a size of 8)
Kevin Enderbyaac75382015-10-08 16:56:35 +000015
Kevin Enderbyfbebe162016-11-02 21:08:39 +000016# RUN: not llvm-objdump -macho -objc-meta-data \
17# RUN: %p/Inputs/malformed-machos/mem-crup-0010.macho 2>&1 \
Kevin Enderbyaac75382015-10-08 16:56:35 +000018# RUN: | FileCheck -check-prefix=m0010 %s
19
Kevin Enderbyfbebe162016-11-02 21:08:39 +000020# m0010: mem-crup-0010.macho': truncated or malformed object (section contents at offset 4320 with a size of 80, overlaps section contents at offset 4320 with a size of 8)
Kevin Enderby46e642f2015-10-08 22:50:55 +000021
Kevin Enderbyc614d282016-08-12 20:10:25 +000022# RUN: not llvm-objdump -macho -objc-meta-data \
23# RUN: %p/Inputs/malformed-machos/mem-crup-0040.macho 2>&1 \
Kevin Enderby46e642f2015-10-08 22:50:55 +000024# RUN: | FileCheck -check-prefix=m0040 %s
25
Kevin Enderbyc614d282016-08-12 20:10:25 +000026# m0040: mem-crup-0040.macho': truncated or malformed object (offset field plus size field of section 2 in LC_SEGMENT_64 command 1 extends past the end of the file)
Kevin Enderbyaf7c9d02015-10-09 16:48:44 +000027
Kevin Enderbyc614d282016-08-12 20:10:25 +000028# RUN: not llvm-objdump -macho -objc-meta-data \
29# RUN: %p/Inputs/malformed-machos/mem-crup-0080.macho 2>&1 \
Kevin Enderbyaf7c9d02015-10-09 16:48:44 +000030# RUN: | FileCheck -check-prefix=m0080 %s
31
Kevin Enderbyc614d282016-08-12 20:10:25 +000032# m0080: mem-crup-0080.macho': truncated or malformed object (addr field plus size of section 2 in LC_SEGMENT_64 command 1 greater than than the segment's vmaddr plus vmsize)
Kevin Enderbyaf7c9d02015-10-09 16:48:44 +000033
Colin LeMahieuefe37322016-04-08 18:15:37 +000034# RUN: llvm-objdump -macho -objc-meta-data \
Kevin Enderbyd1c66dd2015-10-13 17:06:34 +000035# RUN: %p/Inputs/malformed-machos/mem-crup-0261.macho
36
Kevin Enderbyfbebe162016-11-02 21:08:39 +000037# RUN: not llvm-objdump -macho -disassemble \
38# RUN: %p/Inputs/malformed-machos/mem-crup-0337.macho 2>&1 \
Kevin Enderbyd90a4172015-10-10 00:05:01 +000039# RUN: | FileCheck -check-prefix=m0337 %s
40
Kevin Enderbyfbebe162016-11-02 21:08:39 +000041# m0337: mem-crup-0337.macho': truncated or malformed object (section relocation entries at offset 0 with a size of 512, overlaps Mach-O headers at offset 0 with a size of 2048)