1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

Don't dereference a symbol iterator before checking for the end case

llvm-svn: 271173
This commit is contained in:
David Majnemer 2016-05-29 06:18:08 +00:00
parent 6d741ef1bb
commit 2ee323bf42

View File

@ -208,15 +208,19 @@ std::error_code COFFDumper::resolveSymbol(const coff_section *Section,
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