aboutsummaryrefslogtreecommitdiff
path: root/libbacktrace/elf.c
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2019-01-25 14:39:58 +0000
committerTom de Vries <vries@gcc.gnu.org>2019-01-25 14:39:58 +0000
commitc75795fa1dc29716f519ca6d1c8cccb67d0d2062 (patch)
tree4a320ed1ce1aa49329041a5d06027e300d24ee86 /libbacktrace/elf.c
parent37ab491dcee76e83ce32506632810b04a6045d5e (diff)
[libbacktrace] Fix strrchr segfault
Currently, when running a libbacktrace testcase t with .gnu_debuglink to t.debug, and t.debug having a .gnu_debugaltlink to t.alt.debug, a segfault is triggered when calling strrchr with a NULL string from elf_find_debugfile_by_debuglink. The NULL string originates from the elf_add called for the .gnu_debugaltlink, which uses NULL as filename argument. Fix this by using "" as filename argument instead. 2019-01-25 Tom de Vries <tdevries@suse.de> * elf.c (elf_add): When handling .gnu_debugaltlink, call elf_add with filename == "". * Makefile.am (TESTS): Add btest_dwz_gnudebuglink. * Makefile.in: Regenerate. From-SVN: r268269
Diffstat (limited to 'libbacktrace/elf.c')
-rw-r--r--libbacktrace/elf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libbacktrace/elf.c b/libbacktrace/elf.c
index 01cf6f9cff7..632477f3099 100644
--- a/libbacktrace/elf.c
+++ b/libbacktrace/elf.c
@@ -3080,7 +3080,7 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
if (debugaltlink_view_valid)
backtrace_release_view (state, &debugaltlink_view, error_callback,
data);
- ret = elf_add (state, NULL, d, base_address, error_callback, data,
+ ret = elf_add (state, "", d, base_address, error_callback, data,
fileline_fn, found_sym, found_dwarf, NULL, 0, 1, NULL,
0);
if (ret < 0)