libdwfl: Skip relocation on empty or SHT_NOBITS sections.
authorRoland McGrath <roland@redhat.com>
Tue, 17 Nov 2009 04:38:17 +0000 (20:38 -0800)
committerRoland McGrath <roland@redhat.com>
Tue, 17 Nov 2009 04:38:17 +0000 (20:38 -0800)
libdwfl/ChangeLog
libdwfl/relocate.c

index c210bca..2cac0de 100644 (file)
@@ -1,3 +1,7 @@
+2009-11-16  Roland McGrath  <roland@redhat.com>
+
+       * relocate.c (relocate_section): Skip SHT_NOBITS or empty target scn.
+
 2009-11-12  Petr Machata  <pmachata@redhat.com>
 
        * core-file.c (dwfl_elf_phdr_memory_callback): Only load ahead if
index a31fe15..2e37c64 100644 (file)
@@ -302,6 +302,10 @@ relocate_section (Dwfl_Module *mod, Elf *relocated, const GElf_Ehdr *ehdr,
   if (tname == NULL)
     return DWFL_E_LIBELF;
 
+  if (unlikely (tshdr->sh_type == SHT_NOBITS) || unlikely (tshdr->sh_size == 0))
+    /* No contents to relocate.  */
+    return DWFL_E_NOERROR;
+
   if (debugscn && ! ebl_debugscn_p (mod->ebl, tname))
     /* This relocation section is not for a debugging section.
        Nothing to do here.  */