diff options
author | Alexey Samsonov <vonosmas@gmail.com> | 2015-06-04 19:57:46 +0000 |
---|---|---|
committer | Alexey Samsonov <vonosmas@gmail.com> | 2015-06-04 19:57:46 +0000 |
commit | de5a94a6b4d1574fea0f252e65408343338ba664 (patch) | |
tree | e5013ea1b079e1e7db03f78f93112777886c85d6 /llvm/lib/Object/Error.cpp | |
parent | 31d9c47540c89a8219d7439c14123caebc5dde3d (diff) | |
download | bcm5719-llvm-de5a94a6b4d1574fea0f252e65408343338ba664.tar.gz bcm5719-llvm-de5a94a6b4d1574fea0f252e65408343338ba664.zip |
[Object, MachO] Don't crash on invalid MachO load commands.
Summary:
Currently all load commands are parsed in MachOObjectFile constructor.
If the next load command cannot be parsed, or if command size is too
small, properly report it through the error code and fail to construct
the object, instead of crashing the program.
Test Plan: regression test suite
Reviewers: rafael, filcab
Subscribers: llvm-commits
llvm-svn: 239080
Diffstat (limited to 'llvm/lib/Object/Error.cpp')
-rw-r--r-- | llvm/lib/Object/Error.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Object/Error.cpp b/llvm/lib/Object/Error.cpp index d2daab72d58..1c8dad80b0a 100644 --- a/llvm/lib/Object/Error.cpp +++ b/llvm/lib/Object/Error.cpp @@ -44,6 +44,8 @@ std::string _object_error_category::message(int EV) const { return "The end of the file was unexpectedly encountered"; case object_error::bitcode_section_not_found: return "Bitcode section not found in object file"; + case object_error::macho_small_load_command: + return "Mach-O load command with size < 8 bytes"; } llvm_unreachable("An enumerator of object_error does not have a message " "defined."); |