Skip to content

Commit

Permalink
Fix crash when relocation section is malformed
Browse files Browse the repository at this point in the history
Found by a fuzzer

Signed-off-by: Dave Thaler <[email protected]>
  • Loading branch information
dthaler committed Nov 22, 2024
1 parent e4750ee commit 47a35b0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/asm_files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,9 @@ static void append_subprograms(raw_program& prog, const vector<raw_program>& pro

auto [symbol_name, section_index] =
get_symbol_name_and_section_index(symbols, reloc.relocation_entry_index);
if (section_index >= reader.sections.size()) {
continue;
}
ELFIO::section& subprogram_section = *reader.sections[section_index];
auto subprogram = read_subprogram(subprogram_section, symbols, symbol_name);
prog.prog.insert(prog.prog.end(), subprogram.begin(), subprogram.end());
Expand Down

0 comments on commit 47a35b0

Please sign in to comment.