Skip to content

Commit

Permalink
only call dw_get_eh_frame_ranges when section headers are insane and …
Browse files Browse the repository at this point in the history
…forensics flag is set
  • Loading branch information
elfmaster committed Mar 6, 2019
1 parent 44c5a3b commit 1879e92
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/libelfmaster.c
Original file line number Diff line number Diff line change
Expand Up @@ -3031,12 +3031,19 @@ elf_open_object(const char *path, struct elfobj *obj, uint64_t load_flags,

/*
* must get the eh_frame ranges before calling build_symtab_data
* incase we need to reconstruct symbol information from the FDE's
* incase we need to reconstruct symbol information from the FDE's.
* We should only be needing to get the FDE ranges if there are insane
* section headers, otherwise there will be no need for us to parse
* .eh_frame; the sole purpose if dw_get_eh_frame_ranges is to get
* the data necessary to reconstruct .symtab.
*/
if ((obj->flags & ELF_EH_FRAME_F) != 0) {
if (dw_get_eh_frame_ranges(obj) < 0) {
elf_error_set(error, "failed to build FDE data from eh_frame");
goto err;
if (insane_section_headers(obj) == true &&
(load_flags & ELF_LOAD_F_FORENSICS)) {
if ((obj->flags & ELF_EH_FRAME_F) != 0) {
if (dw_get_eh_frame_ranges(obj) < 0) {
elf_error_set(error, "failed to build FDE data from eh_frame");
goto err;
}
}
}
if (build_dynsym_data(obj) == false) {
Expand Down

0 comments on commit 1879e92

Please sign in to comment.