summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2016-10-20 20:10:30 +0000
committerKevin Enderby <enderby@apple.com>2016-10-20 20:10:30 +0000
commitc8bb42283ee6a118219593a2c98abc0974eb5dc4 (patch)
treec36e97a0770dee048074cc653cd776b11b4ac06f /llvm/test
parent613c00db88e0a206e1223e5be7dfeb9b4a868c7d (diff)
downloadbcm5719-llvm-c8bb42283ee6a118219593a2c98abc0974eb5dc4.tar.gz
bcm5719-llvm-c8bb42283ee6a118219593a2c98abc0974eb5dc4.zip
Another additional error check for invalid Mach-O files for the
load commands that use the MachO::twolevel_hints_command type which includes only the LC_TWOLEVEL_HINTS load command. This is not used in llvm libObject code or in llvm tool code. But does appear in one of the binary test files. While this load command is obsolete it is easier to add code for it in libObject than edit or change the binary test case. llvm-svn: 284769
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Object/Inputs/macho-invalid-twolevelhints-bad-sizebin0 -> 48 bytes
-rw-r--r--llvm/test/Object/Inputs/macho-invalid-twolevelhints-more-than-onebin0 -> 60 bytes
-rw-r--r--llvm/test/Object/Inputs/macho-invalid-twolevelhints-offsetbin0 -> 44 bytes
-rw-r--r--llvm/test/Object/Inputs/macho-invalid-twolevelhints-offset-nhintsbin0 -> 44 bytes
-rw-r--r--llvm/test/Object/macho-invalid.test12
5 files changed, 12 insertions, 0 deletions
diff --git a/llvm/test/Object/Inputs/macho-invalid-twolevelhints-bad-size b/llvm/test/Object/Inputs/macho-invalid-twolevelhints-bad-size
new file mode 100644
index 00000000000..a13a00e6d20
--- /dev/null
+++ b/llvm/test/Object/Inputs/macho-invalid-twolevelhints-bad-size
Binary files differ
diff --git a/llvm/test/Object/Inputs/macho-invalid-twolevelhints-more-than-one b/llvm/test/Object/Inputs/macho-invalid-twolevelhints-more-than-one
new file mode 100644
index 00000000000..27e3a17561e
--- /dev/null
+++ b/llvm/test/Object/Inputs/macho-invalid-twolevelhints-more-than-one
Binary files differ
diff --git a/llvm/test/Object/Inputs/macho-invalid-twolevelhints-offset b/llvm/test/Object/Inputs/macho-invalid-twolevelhints-offset
new file mode 100644
index 00000000000..f280f14b923
--- /dev/null
+++ b/llvm/test/Object/Inputs/macho-invalid-twolevelhints-offset
Binary files differ
diff --git a/llvm/test/Object/Inputs/macho-invalid-twolevelhints-offset-nhints b/llvm/test/Object/Inputs/macho-invalid-twolevelhints-offset-nhints
new file mode 100644
index 00000000000..81bf6a11594
--- /dev/null
+++ b/llvm/test/Object/Inputs/macho-invalid-twolevelhints-offset-nhints
Binary files differ
diff --git a/llvm/test/Object/macho-invalid.test b/llvm/test/Object/macho-invalid.test
index 111ba661c93..5a00d0def52 100644
--- a/llvm/test/Object/macho-invalid.test
+++ b/llvm/test/Object/macho-invalid.test
@@ -394,3 +394,15 @@ INVALID-THREAD-UNKNOWN-CPUTYPE: macho-invalid-thread-unknown-cputype': truncated
RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-unixthread-more-than-one 2>&1 | FileCheck -check-prefix INVALID-UNIXTHREAD-MORE-THAN-ONE %s
INVALID-UNIXTHREAD-MORE-THAN-ONE: macho-invalid-unixthread-more-than-one': truncated or malformed object (more than one LC_UNIXTHREAD command)
+
+RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-twolevelhints-bad-size 2>&1 | FileCheck -check-prefix INVALID-TWOLEVELHINTS-BAD-SIZE %s
+INVALID-TWOLEVELHINTS-BAD-SIZE: macho-invalid-twolevelhints-bad-size': truncated or malformed object (load command 0 LC_TWOLEVEL_HINTS has incorrect cmdsize)
+
+RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-twolevelhints-more-than-one 2>&1 | FileCheck -check-prefix INVALID-TWOLEVELHINTS-MORE-THAN-ONE %s
+INVALID-TWOLEVELHINTS-MORE-THAN-ONE: macho-invalid-twolevelhints-more-than-one': truncated or malformed object (more than one LC_TWOLEVEL_HINTS command)
+
+RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-twolevelhints-offset 2>&1 | FileCheck -check-prefix INVALID-TWOLEVELHINTS-OFFSET %s
+INVALID-TWOLEVELHINTS-OFFSET: macho-invalid-twolevelhints-offset': truncated or malformed object (offset field of LC_TWOLEVEL_HINTS command 0 extends past the end of the file)
+
+RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-twolevelhints-offset-nhints 2>&1 | FileCheck -check-prefix INVALID-TWOLEVELHINTS-OFFSET-HNINTS %s
+INVALID-TWOLEVELHINTS-OFFSET-HNINTS: macho-invalid-twolevelhints-offset-nhints': truncated or malformed object (offset field plus nhints times sizeof(struct twolevel_hint) field of LC_TWOLEVEL_HINTS command 0 extends past the end of the file)
OpenPOWER on IntegriCloud