aboutsummaryrefslogtreecommitdiff
path: root/libbacktrace/elf.c
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2019-01-31 12:17:32 +0000
committerTom de Vries <vries@gcc.gnu.org>2019-01-31 12:17:32 +0000
commit3a3f5dd1af1d3007c60ccbabf068a18039c6522c (patch)
tree72ab8bb06bbd1ae1adfdc3836a6202c664a36d11 /libbacktrace/elf.c
parent7ad97d17775832ca57166a8bf302f48ea07a785e (diff)
downloadgcc-3a3f5dd1af1d3007c60ccbabf068a18039c6522c.zip
gcc-3a3f5dd1af1d3007c60ccbabf068a18039c6522c.tar.gz
gcc-3a3f5dd1af1d3007c60ccbabf068a18039c6522c.tar.bz2
[libbacktrace] Fix .gnu_debugaltlink build-id check
The 'debugaltlink_name_len =+ 1' bug reported in PR89136 exposes the fact that the build-id is not verified for the .gnu_debugaltlink. Fix both problems. 2019-01-31 Tom de Vries <tdevries@suse.de> PR libbacktrace/89136 * elf.c (elf_add): Read build-id if with_buildid_data. Fix 'debugaltlink_name_len =+ 1'. From-SVN: r268419
Diffstat (limited to 'libbacktrace/elf.c')
-rw-r--r--libbacktrace/elf.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libbacktrace/elf.c b/libbacktrace/elf.c
index d933052..f3988ec 100644
--- a/libbacktrace/elf.c
+++ b/libbacktrace/elf.c
@@ -2864,7 +2864,7 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
/* Read the build ID if present. This could check for any
SHT_NOTE section with the right note name and type, but gdb
looks for a specific section name. */
- if (!debuginfo
+ if ((!debuginfo || with_buildid_data != NULL)
&& !buildid_view_valid
&& strcmp (name, ".note.gnu.build-id") == 0)
{
@@ -2938,7 +2938,7 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor,
if (debugaltlink_name_len < shdr->sh_size)
{
/* Include terminating zero. */
- debugaltlink_name_len =+ 1;
+ debugaltlink_name_len += 1;
debugaltlink_buildid_data
= debugaltlink_data + debugaltlink_name_len;