elf2uf2: correctly parse ELF files where the program header is not directly following the file header
fixes #506
This commit is contained in:
parent
5e05469373
commit
ccc0ba5649
@ -143,6 +143,9 @@ int read_and_check_elf32_ph_entries(FILE *in, const elf32_header &eh, const addr
|
||||
}
|
||||
if (eh.ph_num) {
|
||||
std::vector<elf32_ph_entry> entries(eh.ph_num);
|
||||
if (fseek(in, eh.ph_offset, SEEK_SET)) {
|
||||
return fail_read_error();
|
||||
}
|
||||
if (eh.ph_num != fread(&entries[0], sizeof(struct elf32_ph_entry), eh.ph_num, in)) {
|
||||
return fail_read_error();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user