[applied,to,mainline] tools-utils.cc: Fix potential crash when testing for CTF debug info

Message ID 87a5n0sv9r.fsf@redhat.com
State New
Headers
Series [applied,to,mainline] tools-utils.cc: Fix potential crash when testing for CTF debug info |

Commit Message

Dodji Seketeli March 14, 2024, 3:11 p.m. UTC
  Hello,

When looking at something else, I stumbled upon a crash when testing
for the presence of CTF debug info.

	* src/abg-tools-utils.cc (file_has_ctf_debug_info): Do not crash
	on empty debug info paths.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Applied to mainline.
---
 src/abg-tools-utils.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/src/abg-tools-utils.cc b/src/abg-tools-utils.cc
index 08d50347..2115113b 100644
--- a/src/abg-tools-utils.cc
+++ b/src/abg-tools-utils.cc
@@ -516,7 +516,7 @@  file_has_ctf_debug_info(const string& elf_file_path,
 
   // vmlinux.ctfa could be provided with --debug-info-dir
   for (const auto& path : debug_info_root_paths)
-    if (find_file_under_dir(*path, "vmlinux.ctfa", vmlinux))
+    if (path && *path && find_file_under_dir(*path, "vmlinux.ctfa", vmlinux))
       return true;
 
   return false;