From: Rafael Espindola Date: Thu, 8 Oct 2015 18:06:20 +0000 (+0000) Subject: Handle Archive::getNumberOfSymbols being called in an archive with no symbols. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8a8ae262f10cc5837cd2b14585c9eec16d9c697b;p=oota-llvm.git Handle Archive::getNumberOfSymbols being called in an archive with no symbols. No change in llvm, but will be tested from lld. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249709 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Object/Archive.cpp b/lib/Object/Archive.cpp index 941f72bb6a6..42fec39851d 100644 --- a/lib/Object/Archive.cpp +++ b/lib/Object/Archive.cpp @@ -510,12 +510,12 @@ Archive::symbol_iterator Archive::symbol_begin() const { } Archive::symbol_iterator Archive::symbol_end() const { - if (!hasSymbolTable()) - return symbol_iterator(Symbol(this, 0, 0)); return symbol_iterator(Symbol(this, getNumberOfSymbols(), 0)); } uint32_t Archive::getNumberOfSymbols() const { + if (!hasSymbolTable()) + return 0; const char *buf = getSymbolTable().begin(); if (kind() == K_GNU) return read32be(buf);