diff options
| author | Kevin Enderby <enderby@apple.com> | 2016-09-20 20:14:14 +0000 |
|---|---|---|
| committer | Kevin Enderby <enderby@apple.com> | 2016-09-20 20:14:14 +0000 |
| commit | fc0929adb8517ceb07a27f599bfff6ac5cb0db2f (patch) | |
| tree | 13ce902c329522d7598705c1cc602ac4f363b991 /llvm/test | |
| parent | 07a791643b810c3e94990513ee7f20b237f3dc7a (diff) | |
| download | bcm5719-llvm-fc0929adb8517ceb07a27f599bfff6ac5cb0db2f.tar.gz bcm5719-llvm-fc0929adb8517ceb07a27f599bfff6ac5cb0db2f.zip | |
Next set of additional error checks for invalid Mach-O files for bad load commands
that use the Mach::dylib_command type for the load commands that are
currently used in the MachOObjectFile constructor.
This contains the missing checks for LC_ID_DYLIB, LC_ID_DYLIB, etc.
load commands and the fields for the Mach::dylib_command type.
Also checks that only an MH_DYLIB or MH_STUB_DYLIB has an
LC_ID_DYLIB load command (and others filetype don’t) and there
is not more than one of these load commands.
llvm-svn: 282008
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/Object/Inputs/macho-invalid-dylib-id-more-than-one | bin | 0 -> 84 bytes | |||
| -rw-r--r-- | llvm/test/Object/Inputs/macho-invalid-dylib-name_offset-toobig | bin | 0 -> 52 bytes | |||
| -rw-r--r-- | llvm/test/Object/Inputs/macho-invalid-dylib-name_offset-toosmall | bin | 0 -> 52 bytes | |||
| -rw-r--r-- | llvm/test/Object/Inputs/macho-invalid-dylib-name_toobig | bin | 0 -> 56 bytes | |||
| -rw-r--r-- | llvm/test/Object/Inputs/macho-invalid-dylib-no-id | bin | 0 -> 28 bytes | |||
| -rw-r--r-- | llvm/test/Object/Inputs/macho-invalid-dylib-small | bin | 0 -> 56 bytes | |||
| -rw-r--r-- | llvm/test/Object/Inputs/macho-invalid-dylib-wrong-filetype | bin | 0 -> 56 bytes | |||
| -rw-r--r-- | llvm/test/Object/macho-invalid.test | 21 |
8 files changed, 21 insertions, 0 deletions
diff --git a/llvm/test/Object/Inputs/macho-invalid-dylib-id-more-than-one b/llvm/test/Object/Inputs/macho-invalid-dylib-id-more-than-one Binary files differnew file mode 100644 index 00000000000..3fcefdb9200 --- /dev/null +++ b/llvm/test/Object/Inputs/macho-invalid-dylib-id-more-than-one diff --git a/llvm/test/Object/Inputs/macho-invalid-dylib-name_offset-toobig b/llvm/test/Object/Inputs/macho-invalid-dylib-name_offset-toobig Binary files differnew file mode 100644 index 00000000000..3a5f0c7e505 --- /dev/null +++ b/llvm/test/Object/Inputs/macho-invalid-dylib-name_offset-toobig diff --git a/llvm/test/Object/Inputs/macho-invalid-dylib-name_offset-toosmall b/llvm/test/Object/Inputs/macho-invalid-dylib-name_offset-toosmall Binary files differnew file mode 100644 index 00000000000..fb3aa3b02a1 --- /dev/null +++ b/llvm/test/Object/Inputs/macho-invalid-dylib-name_offset-toosmall diff --git a/llvm/test/Object/Inputs/macho-invalid-dylib-name_toobig b/llvm/test/Object/Inputs/macho-invalid-dylib-name_toobig Binary files differnew file mode 100644 index 00000000000..11ef9280eef --- /dev/null +++ b/llvm/test/Object/Inputs/macho-invalid-dylib-name_toobig diff --git a/llvm/test/Object/Inputs/macho-invalid-dylib-no-id b/llvm/test/Object/Inputs/macho-invalid-dylib-no-id Binary files differnew file mode 100644 index 00000000000..3715e8c2686 --- /dev/null +++ b/llvm/test/Object/Inputs/macho-invalid-dylib-no-id diff --git a/llvm/test/Object/Inputs/macho-invalid-dylib-small b/llvm/test/Object/Inputs/macho-invalid-dylib-small Binary files differnew file mode 100644 index 00000000000..6aca91e6bca --- /dev/null +++ b/llvm/test/Object/Inputs/macho-invalid-dylib-small diff --git a/llvm/test/Object/Inputs/macho-invalid-dylib-wrong-filetype b/llvm/test/Object/Inputs/macho-invalid-dylib-wrong-filetype Binary files differnew file mode 100644 index 00000000000..c9c862c6e83 --- /dev/null +++ b/llvm/test/Object/Inputs/macho-invalid-dylib-wrong-filetype diff --git a/llvm/test/Object/macho-invalid.test b/llvm/test/Object/macho-invalid.test index 8868b88cff4..b8a1e10148f 100644 --- a/llvm/test/Object/macho-invalid.test +++ b/llvm/test/Object/macho-invalid.test @@ -262,3 +262,24 @@ INVALID-DYLDINFO-EXPORT_OFF-EXPORT_SIZE: macho-invalid-dyldinfo-export_off-expor RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-dyldinfo-more-than-one 2>&1 | FileCheck -check-prefix INVALID-DYLDINFO-MORE-THAN-ONE %s INVALID-DYLDINFO-MORE-THAN-ONE: macho-invalid-dyldinfo-more-than-one': truncated or malformed object (more than one LC_DYLD_INFO and or LC_DYLD_INFO_ONLY command) + +RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-dylib-small 2>&1 | FileCheck -check-prefix INVALID-DYLIB-SMALL %s +INVALID-DYLIB-SMALL: macho-invalid-dylib-small': truncated or malformed object (load command 0 LC_LOAD_DYLIB cmdsize too small) + +RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-dylib-name_offset-toobig 2>&1 | FileCheck -check-prefix INVALID-DYLIB-NAME_OFFSET-TOOBIG %s +INVALID-DYLIB-NAME_OFFSET-TOOBIG: macho-invalid-dylib-name_offset-toobig': truncated or malformed object (load command 0 LC_LOAD_WEAK_DYLIB name.offset field extends past the end of the load command) + +RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-dylib-name_toobig 2>&1 | FileCheck -check-prefix INVALID-DYLIB-NAME_TOOBIG %s +INVALID-DYLIB-NAME_TOOBIG: macho-invalid-dylib-name_toobig': truncated or malformed object (load command 0 LC_LAZY_LOAD_DYLIB library name extends past the end of the load command) + +RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-dylib-name_offset-toosmall 2>&1 | FileCheck -check-prefix INVALID-DYLIB-NAME_OFFSET-TOOSMALL %s +INVALID-DYLIB-NAME_OFFSET-TOOSMALL: macho-invalid-dylib-name_offset-toosmall': truncated or malformed object (load command 0 LC_LOAD_UPWARD_DYLIB name.offset field too small, not past the end of the dylib_command struct) + +RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-dylib-id-more-than-one 2>&1 | FileCheck -check-prefix INVALID-DYLIB-ID-MORE-THAN-ONE %s +INVALID-DYLIB-ID-MORE-THAN-ONE: macho-invalid-dylib-id-more-than-one': truncated or malformed object (more than one LC_ID_DYLIB command) + +RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-dylib-wrong-filetype 2>&1 | FileCheck -check-prefix INVALID-DYLIB-WRONG-FILETYPE %s +INVALID-DYLIB-WRONG-FILETYPE: macho-invalid-dylib-wrong-filetype': truncated or malformed object (LC_ID_DYLIB load command in non-dynamic library file type) + +RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-dylib-no-id 2>&1 | FileCheck -check-prefix INVALID-DYLIB-NO-ID %s +INVALID-DYLIB-NO-ID: macho-invalid-dylib-no-id': truncated or malformed object (no LC_ID_DYLIB load command in dynamic library filetype) |

