Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash when relocation section is malformed #800

Merged
merged 1 commit into from
Nov 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/asm_files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ 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()) {
throw UnmarshalError("Invalid section index " + std::to_string(section_index) + " at source offset " +
std::to_string(reloc.source_offset));
}
dthaler marked this conversation as resolved.
Show resolved Hide resolved
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
Loading