find_dynsym could succeed after find_symtab failed but had already set up
symdata, syments and first_global. find_dynsym would not set or clear
first_global since all syms in dynsym are global. Causing lots of failing
lookups when calling __libdwfl_addrsym if first_global was some huge
bogus value.
Reported-by: Hanno Böck <hanno@hboeck.de>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
+2015-01-26 Mark Wielaard <mjw@redhat.com>
+
+ * dwfl_module_getdwarf.c (find_symtab): Explicitly clear symdata,
+ syments and first_global on elferr before calling find_dynsym.
+
2014-12-27 Mark Wielaard <mjw@redhat.com>
* dwfl_module_getsrc.c (dwfl_module_getsrc): Never match a line that
if (elf_strptr (mod->symfile->elf, strshndx, 0) == NULL)
{
elferr:
+ mod->symdata = NULL;
+ mod->syments = 0;
+ mod->first_global = 0;
mod->symerr = DWFL_E (LIBELF, elf_errno ());
goto aux_cleanup; /* This cleans up some more and tries find_dynsym. */
}