]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
libdwfl: Return failure from dwfl_standard_find_debuginfo for NULL module.
authorMark Wielaard <mark@klomp.org>
Sat, 9 May 2020 20:09:40 +0000 (22:09 +0200)
committerMark Wielaard <mark@klomp.org>
Thu, 14 May 2020 12:30:57 +0000 (14:30 +0200)
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 <mark@klomp.org>
libdwfl/ChangeLog
libdwfl/find-debuginfo.c

index 05d5bd4ad6a911dfa27a18ba7fba079ae6b8c77a..4f1ec9da4c029621ca01332d6509f24b1cf054da 100644 (file)
@@ -1,3 +1,8 @@
+2020-05-09  Mark Wielaard  <mark@klomp.org>
+
+       * find-debuginfo.c (dwfl_standard_find_debuginfo): Return failure
+       when mod is NULL.
+
 2020-05-08  Mark Wielaard  <mark@klomp.org>
 
        * libdwfl/core-file.c (dwfl_core_file_report): Keep track of
index 4cfd0b8b27b8737270fdca53062e02a2b40ba8d4..eb68d549d6e5e03ec60eceb2ed6f77f64b241232 100644 (file)
@@ -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;