[PATCH] readelf and DT_RUNPATH

Thomas Cougnard thomas.cougnard@gmail.com
Thu Oct 22 15:25:00 GMT 2009


Hi,

When processing the dynamic section and encountering a DT_RUNPATH
entry, the following code (readelf.c:6383)
       case DT_RUNPATH :
         dynamic_info[entry->d_tag] = entry->d_un.d_val;

corrupts version_info, since entry->d_tag is 29 and dynamic_info is

static bfd_vma dynamic_info[DT_JMPREL + 1];
static bfd_vma dynamic_info_DT_GNU_HASH;
static bfd_vma version_info[16];

with DT_JMPREL equals to 23

This patch should fix it.

Thanks
Thomas
[Please CC me]

--- binutils-orig/binutils/readelf.c    2009-10-16 12:05:06.000000000 +0200
+++ binutils/binutils/readelf.c 2009-10-22 15:30:01.000000000 +0200
@@ -165,7 +165,7 @@
 static unsigned long dynamic_syminfo_offset;
 static unsigned int dynamic_syminfo_nent;
 static char program_interpreter[PATH_MAX];
-static bfd_vma dynamic_info[DT_JMPREL + 1];
+static bfd_vma dynamic_info[DT_RUNPATH + 1];
 static bfd_vma dynamic_info_DT_GNU_HASH;
 static bfd_vma version_info[16];
 static Elf_Internal_Ehdr elf_header;



More information about the Binutils mailing list