summaryrefslogtreecommitdiffstats
path: root/libdwfl
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2015-01-26 16:34:57 +0100
committerMark Wielaard <[email protected]>2015-02-06 22:40:50 +0100
commit96f7667a2e804465adc3d4cfbb17c022adfa40f0 (patch)
treec454d0709b02765d4ebdda1c47dd3d25ecb89900 /libdwfl
parent9d481b29e773f01781f70f1bcdfc05dd66c796ea (diff)
libdwfl: Clear symtab result on error before using find_dynsym fallback.
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 <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'libdwfl')
-rw-r--r--libdwfl/ChangeLog5
-rw-r--r--libdwfl/dwfl_module_getdwarf.c3
2 files changed, 8 insertions, 0 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 5a975781..d40dbae3 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-26 Mark Wielaard <[email protected]>
+
+ * dwfl_module_getdwarf.c (find_symtab): Explicitly clear symdata,
+ syments and first_global on elferr before calling find_dynsym.
+
2014-12-27 Mark Wielaard <[email protected]>
* dwfl_module_getsrc.c (dwfl_module_getsrc): Never match a line that
diff --git a/libdwfl/dwfl_module_getdwarf.c b/libdwfl/dwfl_module_getdwarf.c
index 494407dd..a31898a0 100644
--- a/libdwfl/dwfl_module_getdwarf.c
+++ b/libdwfl/dwfl_module_getdwarf.c
@@ -1083,6 +1083,9 @@ find_symtab (Dwfl_Module *mod)
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. */
}