From 4d7f70d47e027f5ba6d532cd4bd4f53014b9bd7a Mon Sep 17 00:00:00 2001 From: Juergen Ributzka Date: Fri, 19 Dec 2014 02:31:01 +0000 Subject: [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 --- llvm/lib/Object/MachOObjectFile.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Object/MachOObjectFile.cpp') diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp index fd086af..92981fe 100644 --- a/llvm/lib/Object/MachOObjectFile.cpp +++ b/llvm/lib/Object/MachOObjectFile.cpp @@ -1640,7 +1640,10 @@ void ExportEntry::moveNext() { iterator_range MachOObjectFile::exports(ArrayRef Trie) { ExportEntry Start(Trie); - Start.moveToFirst(); + if (Trie.size() == 0) + Start.moveToEnd(); + else + Start.moveToFirst(); ExportEntry Finish(Trie); Finish.moveToEnd(); -- cgit v1.1