| 1 |
## This test ensures that LLVM will not crash when converting a Mach-O object |
| 2 |
## file with a malformed symbol whose n_sect points to an invalid offset. |
| 3 |
|
| 4 |
# RUN: yaml2obj %s -o %t |
| 5 |
# RUN: not llvm-gsymutil --convert %t -o %t.o 2>&1 | FileCheck %s |
| 6 |
|
| 7 |
# CHECK: Loaded 0 functions from symbol table. |
| 8 |
|
| 9 |
--- !mach-o |
| 10 |
FileHeader: |
| 11 |
magic: 0xFEEDFACF |
| 12 |
cputype: 0x01000007 |
| 13 |
cpusubtype: 0x00000003 |
| 14 |
filetype: 0x0000000A |
| 15 |
ncmds: 1 |
| 16 |
sizeofcmds: 100 |
| 17 |
flags: 0x00000000 |
| 18 |
reserved: 0x00000000 |
| 19 |
LoadCommands: |
| 20 |
- cmd: LC_SYMTAB |
| 21 |
cmdsize: 24 |
| 22 |
symoff: 4096 |
| 23 |
nsyms: 1 |
| 24 |
stroff: 4144 |
| 25 |
strsize: 6 |
| 26 |
LinkEditData: |
| 27 |
NameList: |
| 28 |
- n_strx: 2 # _foo |
| 29 |
n_type: 0x0e |
| 30 |
n_sect: 3 # Points to an invalid offset. |
| 31 |
n_desc: 0 |
| 32 |
n_value: 1234 |
| 33 |
StringTable: |
| 34 |
- '' |
| 35 |
- '' |
| 36 |
- _foo |