From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (wildebeest.demon.nl [212.238.236.112]) by sourceware.org (Postfix) with ESMTPS id 3C148383E827 for ; Sun, 10 May 2020 19:59:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3C148383E827 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mark@klomp.org Received: from librem (deer0x15.wildebeest.org [172.31.17.151]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 7B29E300B2FD; Sun, 10 May 2020 21:59:15 +0200 (CEST) Received: by librem (Postfix, from userid 1000) id 5463BC031D; Sun, 10 May 2020 21:58:50 +0200 (CEST) From: Mark Wielaard To: elfutils-devel@sourceware.org Cc: David Malcolm , Mark Wielaard Subject: [PATCH 6/7] libdwfl: Return failure from dwfl_standard_find_debuginfo for NULL module. Date: Sun, 10 May 2020 21:53:39 +0200 Message-Id: <20200510195339.37191-7-mark@klomp.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200510195339.37191-1-mark@klomp.org> References: <20200510195339.37191-1-mark@klomp.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-14.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 May 2020 19:59:18 -0000 GCC10 -fanalyzer plus -flto notices that some functions called by dwfl_standard_find_debuginfo check that the given module isn't NULL, but others expect it to be non-NULL. Just return a failure immediately when a NULL mod is passed to dwfl_standard_find_debuginfo. Signed-off-by: Mark Wielaard --- libdwfl/ChangeLog | 5 +++++ libdwfl/find-debuginfo.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 05d5bd4a..4f1ec9da 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,8 @@ +2020-05-09 Mark Wielaard + + * find-debuginfo.c (dwfl_standard_find_debuginfo): Return failure + when mod is NULL. + 2020-05-08 Mark Wielaard * libdwfl/core-file.c (dwfl_core_file_report): Keep track of diff --git a/libdwfl/find-debuginfo.c b/libdwfl/find-debuginfo.c index 4cfd0b8b..eb68d549 100644 --- a/libdwfl/find-debuginfo.c +++ b/libdwfl/find-debuginfo.c @@ -355,6 +355,9 @@ dwfl_standard_find_debuginfo (Dwfl_Module *mod, GElf_Word debuglink_crc, char **debuginfo_file_name) { + if (mod == NULL) + return -1; + /* First try by build ID if we have one. If that succeeds or fails other than just by finding nothing, that's all we do. */ const unsigned char *bits = NULL; -- 2.20.1