summaryrefslogtreecommitdiff
path: root/test/Object
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2016-10-31 20:29:48 +0000
committerKevin Enderby <enderby@apple.com>2016-10-31 20:29:48 +0000
commite9885e072be0fc74531ffc004f5b4b8cac258f08 (patch)
tree9826a3dbb887e8784e0739b28e807877bfeaa8dd /test/Object
parent7e057dcd4e19ef38ea59c2dc00fb13bda64c5ecf (diff)
More additional error checks for invalid Mach-O files when
the offsets and sizes of an element of the file overlaps with another element in the Mach-O file. This shows the approach to this testing for three elements and contains for tests for their overlap. Checking for all the remain elements will be added next. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285632 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Object')
-rw-r--r--test/Object/Inputs/macho-invalid-strtab-overlapbin0 -> 80 bytes
-rw-r--r--test/Object/Inputs/macho-invalid-symtab-overlapbin0 -> 52 bytes
-rw-r--r--test/Object/macho-invalid.test6
3 files changed, 6 insertions, 0 deletions
diff --git a/test/Object/Inputs/macho-invalid-strtab-overlap b/test/Object/Inputs/macho-invalid-strtab-overlap
new file mode 100644
index 00000000000..279728acce9
--- /dev/null
+++ b/test/Object/Inputs/macho-invalid-strtab-overlap
Binary files differ
diff --git a/test/Object/Inputs/macho-invalid-symtab-overlap b/test/Object/Inputs/macho-invalid-symtab-overlap
new file mode 100644
index 00000000000..9fc5b8e9f51
--- /dev/null
+++ b/test/Object/Inputs/macho-invalid-symtab-overlap
Binary files differ
diff --git a/test/Object/macho-invalid.test b/test/Object/macho-invalid.test
index f95eebc315a..105bfb075f3 100644
--- a/test/Object/macho-invalid.test
+++ b/test/Object/macho-invalid.test
@@ -433,3 +433,9 @@ INVALID-FVMFILE-OBSOLETE: macho-invalid-fvmfile-obsolete': truncated or malforme
RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-prepage-obsolete 2>&1 | FileCheck -check-prefix INVALID-PREPAGE-OBSOLETE %s
INVALID-PREPAGE-OBSOLETE: macho-invalid-prepage-obsolete': truncated or malformed object (load command 0 for cmd value of: 10 is obsolete and not supported)
+
+RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-symtab-overlap 2>&1 | FileCheck -check-prefix INVALID-SYMTAB-OVERLAP %s
+INVALID-SYMTAB-OVERLAP: macho-invalid-symtab-overlap': truncated or malformed object (symbol table at offset 8 with a size of 12, overlaps Mach-O headers at offset 0 with a size of 52)
+
+RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-strtab-overlap 2>&1 | FileCheck -check-prefix INVALID-STRTAB-OVERLAP %s
+INVALID-STRTAB-OVERLAP: macho-invalid-strtab-overlap': truncated or malformed object (string table at offset 60 with a size of 16, overlaps symbol table at offset 52 with a size of 12)