mirror of
https://github.com/RPCSX/llvm.git
synced 2025-03-02 18:06:17 +00:00
Don't dereference a symbol iterator before checking for the end case
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271173 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b829a5d681
commit
02cabd40cd
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user