summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object/MachOObjectFile.cpp
diff options
context:
space:
mode:
authorJuergen Ributzka <juergen@apple.com>2014-12-19 02:31:01 +0000
committerJuergen Ributzka <juergen@apple.com>2014-12-19 02:31:01 +0000
commit4d7f70d47e027f5ba6d532cd4bd4f53014b9bd7a (patch)
tree4aaa49f05dbac902b5b374e2f61a5190a6698a43 /llvm/lib/Object/MachOObjectFile.cpp
parentce1d30142c19a05e45f4e73e7dae689ceb6ba26e (diff)
downloadbcm5719-llvm-4d7f70d47e027f5ba6d532cd4bd4f53014b9bd7a.tar.gz
bcm5719-llvm-4d7f70d47e027f5ba6d532cd4bd4f53014b9bd7a.zip
[Object] Don't crash on empty export lists.
Summary: This fixes the exports iterator if the export list is empty. Reviewers: Bigcheese, kledzik Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D6732 llvm-svn: 224563
Diffstat (limited to 'llvm/lib/Object/MachOObjectFile.cpp')
-rw-r--r--llvm/lib/Object/MachOObjectFile.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp
index fd086af6d52..92981fe6b7e 100644
--- a/llvm/lib/Object/MachOObjectFile.cpp
+++ b/llvm/lib/Object/MachOObjectFile.cpp
@@ -1640,7 +1640,10 @@ void ExportEntry::moveNext() {
iterator_range<export_iterator>
MachOObjectFile::exports(ArrayRef<uint8_t> Trie) {
ExportEntry Start(Trie);
- Start.moveToFirst();
+ if (Trie.size() == 0)
+ Start.moveToEnd();
+ else
+ Start.moveToFirst();
ExportEntry Finish(Trie);
Finish.moveToEnd();
OpenPOWER on IntegriCloud