Skip to content

Commit

Permalink
Jitdump error on replaced element
Browse files Browse the repository at this point in the history
The index used was invalid, which could lead to a memory corruption
  • Loading branch information
r1viollet committed Apr 11, 2024
1 parent ede27f8 commit 9c8f092
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/runtime_symbol_lookup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ bool RuntimeSymbolLookup::insert_or_replace(std::string_view symbol,
code_load.code_addr, code_load.code_size + code_load.code_addr);
#endif
if (symbol_table[existing]._demangled_name == symbol) {
// nothing to do (unlikely size would change ?)
find_res.first->second.set_end(address + code_size - 1);
} else {
// remove current element (as start can be different)
symbol_map.erase(find_res.first);
symbol_map.emplace(
address, SymbolSpan(address + code_size - 1, symbol_table.size()));
symbol_map.emplace(address,
SymbolSpan(address + code_size - 1, existing));
symbol_table[existing]._demangled_name = symbol;
symbol_table[existing]._symname = symbol;
}
Expand Down

0 comments on commit 9c8f092

Please sign in to comment.