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

Dodji Seketeli dodji@redhat.com
Thu Mar 14 15:11:44 GMT 2024


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(-)

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;
-- 
2.39.3


-- 
		Dodji



More information about the Libabigail mailing list