From c75795fa1dc29716f519ca6d1c8cccb67d0d2062 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Fri, 25 Jan 2019 14:39:58 +0000 Subject: [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 * 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 --- libbacktrace/elf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libbacktrace/elf.c') diff --git a/libbacktrace/elf.c b/libbacktrace/elf.c index 01cf6f9..632477f 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) -- cgit v1.1