From: Mark Wielaard Date: Sat, 9 May 2020 20:09:40 +0000 (+0200) Subject: libdwfl: Return failure from dwfl_standard_find_debuginfo for NULL module. X-Git-Tag: elfutils-0.180~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dca13089f93807f99f447b9b033ac27a43ff913f;p=thirdparty%2Felfutils.git libdwfl: Return failure from dwfl_standard_find_debuginfo for NULL module. 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 --- diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 05d5bd4ad..4f1ec9da4 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 4cfd0b8b2..eb68d549d 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;