]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
libdwfl: Check symbol section exists and has a sane entsize in find_symtab.
authorMark Wielaard <mjw@redhat.com>
Thu, 18 Jun 2015 08:46:20 +0000 (10:46 +0200)
committerMark Wielaard <mjw@redhat.com>
Fri, 19 Jun 2015 10:24:46 +0000 (12:24 +0200)
Signed-off-by: Mark Wielaard <mjw@redhat.com>
libdwfl/ChangeLog
libdwfl/dwfl_module_getdwarf.c

index a5253e26155483e3052af9b7f9475533893fb426..ca987833a7f56887760ffe6fa239582742b5d87f 100644 (file)
@@ -1,3 +1,8 @@
+2015-06-18  Mark Wielaard  <mjw@redhat.com>
+
+       * dwfl_module_getdwarf.c (find_symtab): Check shdr is not NULL and
+       sh_entsize is not zero.
+
 2015-06-06  Mark Wielaard  <mjw@redhat.com>
 
        * find-debuginfo.c (find_debuginfo_in_path): Always free localpath,
index 908a9eee1077e588cd8fcaf8f6a5256cfe130759..dba9d664969e9e34af255240d4a541a102b01748 100644 (file)
@@ -1135,7 +1135,8 @@ find_symtab (Dwfl_Module *mod)
 
   // Sanity check number of symbols.
   GElf_Shdr shdr_mem, *shdr = gelf_getshdr (symscn, &shdr_mem);
-  if (mod->syments > mod->symdata->d_size / shdr->sh_entsize
+  if (shdr == NULL || shdr->sh_entsize == 0
+      || mod->syments > mod->symdata->d_size / shdr->sh_entsize
       || (size_t) mod->first_global > mod->syments)
     goto elferr;