aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-09-30 14:04:08 +0930
committerAlan Modra <amodra@gmail.com>2019-10-09 00:30:52 +1030
commit7cb2dcb804d0af6b5fa9981907bc1f097730ac1b (patch)
tree974799882b04e75e226fcc17dc66f8759236f55c
parentPR24262, plugin search dir doesn't respect --libdir (diff)
downloadbinutils-gdb-7cb2dcb804d0af6b5fa9981907bc1f097730ac1b.tar.gz
binutils-gdb-7cb2dcb804d0af6b5fa9981907bc1f097730ac1b.tar.bz2
binutils-gdb-7cb2dcb804d0af6b5fa9981907bc1f097730ac1b.zip
PR25046, readelf "Reading xxx bytes extends past end of file for dynamic section"
PR 25046 * readelf.c (process_program_headers): Clear dynamic_addr and dynamic_size earlier. (cherry picked from commit 663f67df1e8a7ac0ab8c8c577817067ca32ea4be)
-rw-r--r--binutils/ChangeLog8
-rw-r--r--binutils/readelf.c6
2 files changed, 11 insertions, 3 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 3babbb667c..5de97327df 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,11 @@
+2019-10-09 Alan Modra <amodra@gmail.com>
+
+ Apply from master
+ 2019-09-30 Alan Modra <amodra@gmail.com>
+ PR 25046
+ * readelf.c (process_program_headers): Clear dynamic_addr and
+ dynamic_size earlier.
+
2019-10-02 Niklas G├╝rtler <profclonk@gmail.com>
PR 24942
diff --git a/binutils/readelf.c b/binutils/readelf.c
index cc168163b2..0962877ad8 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -5101,6 +5101,9 @@ process_program_headers (Filedata * filedata)
unsigned int i;
Elf_Internal_Phdr * previous_load = NULL;
+ dynamic_addr = 0;
+ dynamic_size = 0;
+
if (filedata->file_header.e_phnum == 0)
{
/* PR binutils/12467. */
@@ -5151,9 +5154,6 @@ process_program_headers (Filedata * filedata)
}
}
- dynamic_addr = 0;
- dynamic_size = 0;
-
for (i = 0, segment = filedata->program_headers;
i < filedata->file_header.e_phnum;
i++, segment++)