[llvm] r271173 - Don't dereference a symbol iterator before checking for the end case
David Majnemer via llvm-commits
llvm-commits at lists.llvm.org
Sat May 28 23:18:08 PDT 2016
Author: majnemer
Date: Sun May 29 01:18:08 2016
New Revision: 271173
URL: http://llvm.org/viewvc/llvm-project?rev=271173&view=rev
Log:
Don't dereference a symbol iterator before checking for the end case
Modified:
llvm/trunk/tools/llvm-readobj/COFFDumper.cpp
Modified: llvm/trunk/tools/llvm-readobj/COFFDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/COFFDumper.cpp?rev=271173&r1=271172&r2=271173&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/COFFDumper.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/COFFDumper.cpp Sun May 29 01:18:08 2016
@@ -208,15 +208,19 @@ std::error_code COFFDumper::resolveSymbo
uint64_t Offset, SymbolRef &Sym) {
cacheRelocations();
const auto &Relocations = RelocMap[Section];
+ auto SymI = Obj->symbol_end();
for (const auto &Relocation : Relocations) {
uint64_t RelocationOffset = Relocation.getOffset();
if (RelocationOffset == Offset) {
- Sym = *Relocation.getSymbol();
- return readobj_error::success;
+ SymI = Relocation.getSymbol();
+ break;
}
}
- return readobj_error::unknown_symbol;
+ if (SymI == Obj->symbol_end())
+ return readobj_error::unknown_symbol;
+ Sym = *SymI;
+ return readobj_error::success;
}
// Given a section and an offset into this section the function returns the name
More information about the llvm-commits
mailing list