PR25046, readelf "Reading xxx bytes extends past end of file for dynamic section"
authorAlan Modra <amodra@gmail.com>
Mon, 30 Sep 2019 04:34:08 +0000 (14:04 +0930)
committerAlan Modra <amodra@gmail.com>
Mon, 30 Sep 2019 04:48:14 +0000 (14:18 +0930)
PR 25046
* readelf.c (process_program_headers): Clear dynamic_addr and
dynamic_size earlier.

binutils/ChangeLog
binutils/readelf.c

index a136e5b716da5271c1f5c5dea704c5966a352257..dcc876c67b76453e2eee4a83f28a1c19de0afab9 100644 (file)
@@ -1,3 +1,9 @@
+2019-09-30  Alan Modra  <amodra@gmail.com>
+
+       PR 25046
+       * readelf.c (process_program_headers): Clear dynamic_addr and
+       dynamic_size earlier.
+
 2019-09-24  Alan Modra  <amodra@gmail.com>
 
        PR 25031
index cc168163b2166795c58e572ebfbd219562fcc20e..0962877ad8febbfe418b8275a20a509805876020 100644 (file)
@@ -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++)