Make the ELFFile constructor private.
With this all clients have to use the new create method which returns
an Expected.
Fixes a crash on invalid input.
llvm-svn: 315376
diff --git a/llvm/test/Object/Inputs/invalid-buffer.elf b/llvm/test/Object/Inputs/invalid-buffer.elf
new file mode 100644
index 0000000..665d9d1
--- /dev/null
+++ b/llvm/test/Object/Inputs/invalid-buffer.elf
@@ -0,0 +1 @@
+ELF
\ No newline at end of file
diff --git a/llvm/test/Object/invalid.test b/llvm/test/Object/invalid.test
index 8d2cb72..6654225 100644
--- a/llvm/test/Object/invalid.test
+++ b/llvm/test/Object/invalid.test
@@ -81,3 +81,6 @@
RUN: not llvm-readobj -r %p/Inputs/invalid-rel-sym.elf 2>&1 | FileCheck --check-prefix=INVALID-REL-SYM %s
INVALID-REL-SYM: invalid section offset
+
+RUN: not llvm-readobj -r %p/Inputs/invalid-buffer.elf 2>&1 | FileCheck --check-prefix=INVALID-BUFFER %s
+INVALID-BUFFER: Invalid buffer