From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 47246 invoked by alias); 4 Apr 2018 14:48:38 -0000 Mailing-List: contact elfutils-devel-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: elfutils-devel-owner@sourceware.org Received: (qmail 46015 invoked by uid 89); 4 Apr 2018 14:48:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.99.4 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.2 spammy=H*Ad:U*mark X-Spam-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: gnu.wildebeest.org Received: from wildebeest.demon.nl (HELO gnu.wildebeest.org) (212.238.236.112) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 04 Apr 2018 14:48:32 +0000 Received: from tarox.wildebeest.org (tarox.wildebeest.org [172.31.17.39]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 006AD30008A2; Wed, 4 Apr 2018 16:48:29 +0200 (CEST) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id B481B4000AA9; Wed, 4 Apr 2018 16:48:29 +0200 (CEST) From: Mark Wielaard To: elfutils-devel@sourceware.org Cc: Mark Wielaard Subject: [COMMITTED] libdw: Make sure to initialize Dwarf_CU addr_base and str_off_base. Date: Wed, 04 Apr 2018 14:48:00 -0000 Message-Id: <1522853307-23728-1-git-send-email-mark@klomp.org> X-Mailer: git-send-email 1.8.3.1 X-Spam-Flag: NO X-IsSubscribed: yes X-SW-Source: 2018-q2/txt/msg00003.txt.bz2 The patches for .debug_addr and .debug_str_offsets didn't properly initialize the addr_base and str_off_base CU fields causing random results. The __libdw_cu_addr_base () and __libdw_cu_str_off_base () functions rely on these fields being initialized to -1 when the values have not yet been set up. Shows up as a valgrind warning. Signed-off-by: Mark Wielaard --- libdw/ChangeLog | 5 +++++ libdw/libdw_findcu.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/libdw/ChangeLog b/libdw/ChangeLog index ee6a1eb..ad62771 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,8 @@ +2018-04-04 Mark Wielaard + + * libdw_findcu.c (__libdw_intern_next_unit): Initialize Dwarf_CU + addr_base and str_off_base. + 2018-03-23 Mark Wielaard * dwarf_begin_elf.c (dwarf_scnnames): Add IDX_debug_str_offsets, diff --git a/libdw/libdw_findcu.c b/libdw/libdw_findcu.c index 4d1d842..04390b4 100644 --- a/libdw/libdw_findcu.c +++ b/libdw/libdw_findcu.c @@ -116,6 +116,8 @@ __libdw_intern_next_unit (Dwarf *dbg, bool debug_types) newp->orig_abbrev_offset = newp->last_abbrev_offset = abbrev_offset; newp->lines = NULL; newp->locs = NULL; + newp->addr_base = (Dwarf_Off) -1; + newp->str_off_base = (Dwarf_Off) -1; newp->startp = data->d_buf + newp->start; newp->endp = data->d_buf + newp->end; -- 1.8.3.1