[Object, MachO] Don't crash on invalid MachO load commands.
authorAlexey Samsonov <vonosmas@gmail.com>
Thu, 4 Jun 2015 19:57:46 +0000 (19:57 +0000)
committerAlexey Samsonov <vonosmas@gmail.com>
Thu, 4 Jun 2015 19:57:46 +0000 (19:57 +0000)
commit7e699dce03ed9ac10be159f72490ab6d31e7b27e
tree789e2a466633742d7f9e175dae2fca82b7845db2
parent08a382531c8e282bd2e346b896b5fe78ba9d11d2
[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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239080 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Object/Error.h
lib/Object/Error.cpp
lib/Object/MachOObjectFile.cpp
test/Object/macho-invalid.test