Skip to content
Open
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
3 changes: 3 additions & 0 deletions flows/verilator/src/binary_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ Elf64_Ehdr get_elf_header(ifstream& file) {
file.seekg(0, file.beg);
file.read((char*)&header, sizeof(Elf64_Ehdr));

if (!file || file.gcount() != sizeof(Elf64_Ehdr))
throw std::runtime_error("Failed to read ELF header");

if (header.e_machine != EM_RISCV)
throw std::runtime_error("Received non-RISC-V binary");

Expand Down