aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/Error.cpp
diff options
context:
space:
mode:
authorAlexey Samsonov <vonosmas@gmail.com>2015-06-04 20:08:52 +0000
committerAlexey Samsonov <vonosmas@gmail.com>2015-06-04 20:08:52 +0000
commit074da9b5e7201ceaed997a1ff2eab4464b62da4c (patch)
treef572c7fd89e7aaedd3f646d74275ae09beadcb5d /llvm/lib/Object/Error.cpp
parentde5a94a6b4d1574fea0f252e65408343338ba664 (diff)
downloadllvm-074da9b5e7201ceaed997a1ff2eab4464b62da4c.zip
llvm-074da9b5e7201ceaed997a1ff2eab4464b62da4c.tar.gz
llvm-074da9b5e7201ceaed997a1ff2eab4464b62da4c.tar.bz2
[Object, MachO] Don't crash on invalid MachO segment load commands.
Summary: Properly report the error in segment load commands from MachOObjectFile constructor instead of crashing the program. Adjust the test case accordingly. Test Plan: regression test suite Reviewers: rafael, filcab Subscribers: llvm-commits llvm-svn: 239081
Diffstat (limited to 'llvm/lib/Object/Error.cpp')
-rw-r--r--llvm/lib/Object/Error.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Object/Error.cpp b/llvm/lib/Object/Error.cpp
index 1c8dad8..5e4e237 100644
--- a/llvm/lib/Object/Error.cpp
+++ b/llvm/lib/Object/Error.cpp
@@ -46,6 +46,10 @@ std::string _object_error_category::message(int EV) const {
return "Bitcode section not found in object file";
case object_error::macho_small_load_command:
return "Mach-O load command with size < 8 bytes";
+ case object_error::macho_load_segment_too_many_sections:
+ return "Mach-O segment load command contains too many sections";
+ case object_error::macho_load_segment_too_small:
+ return "Mach-O segment load command size is too small";
}
llvm_unreachable("An enumerator of object_error does not have a message "
"defined.");