From 46e642f8c56022f4218699a7071996e7e0863ba2 Mon Sep 17 00:00:00 2001 From: Kevin Enderby Date: Thu, 8 Oct 2015 22:50:55 +0000 Subject: Fix a bug in llvm-objdump’s printing of Objective-C meta data from malformed Mach-O files that caused a crash because of a section header had a size that extended past the end of the file. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit rdar://22983603 llvm-svn: 249768 --- llvm/tools/llvm-objdump/MachODump.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'llvm/tools/llvm-objdump/MachODump.cpp') diff --git a/llvm/tools/llvm-objdump/MachODump.cpp b/llvm/tools/llvm-objdump/MachODump.cpp index b6b910f55dc..993e9e6817b 100644 --- a/llvm/tools/llvm-objdump/MachODump.cpp +++ b/llvm/tools/llvm-objdump/MachODump.cpp @@ -2340,6 +2340,8 @@ static const char *get_pointer_64(uint64_t Address, uint32_t &offset, for (unsigned SectIdx = 0; SectIdx != info->Sections->size(); SectIdx++) { uint64_t SectAddress = ((*(info->Sections))[SectIdx]).getAddress(); uint64_t SectSize = ((*(info->Sections))[SectIdx]).getSize(); + if (SectSize == 0) + continue; if (objc_only) { StringRef SectName; ((*(info->Sections))[SectIdx]).getName(SectName); -- cgit v1.2.3