diff options
-rw-r--r-- | binutils/ChangeLog | 5 | ||||
-rw-r--r-- | binutils/readelf.c | 16 |
2 files changed, 15 insertions, 6 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 8fc5671..26a20d3 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,8 @@ +2017-03-20 Mark Wielaard <mark@klomp.org> + + * readelf.c (process_program_headers): Move dynamic_addr check + after .dynamic section cross check. + 2017-03-17 Nick Clifton <nickc@redhat.com> * readelf.c (print_gnu_build_attribute_name): Fix off by one error diff --git a/binutils/readelf.c b/binutils/readelf.c index ad65f07..8b1d924 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -4997,12 +4997,6 @@ process_program_headers (FILE * file) section in the DYNAMIC segment. */ dynamic_addr = segment->p_offset; dynamic_size = segment->p_filesz; - /* PR binutils/17512: Avoid corrupt dynamic section info in the segment. */ - if (dynamic_addr + dynamic_size >= current_file_size) - { - error (_("the dynamic segment offset + size exceeds the size of the file\n")); - dynamic_addr = dynamic_size = 0; - } /* Try to locate the .dynamic section. If there is a section header table, we can easily locate it. */ @@ -5037,6 +5031,16 @@ process_program_headers (FILE * file) warn (_("the .dynamic section is not the first section" " in the dynamic segment.\n")); } + + /* PR binutils/17512: Avoid corrupt dynamic section info in the + segment. Check this after matching against the section headers + so we don't warn on debuginfo file (which have NOBITS .dynamic + sections). */ + if (dynamic_addr + dynamic_size >= current_file_size) + { + error (_("the dynamic segment offset + size exceeds the size of the file\n")); + dynamic_addr = dynamic_size = 0; + } break; case PT_INTERP: |