asan: _bfd_stab_section_find_nearest_line segv
Alan Modra
amodra@gmail.com
Wed Sep 28 00:57:49 GMT 2022
The segv was on "info->strs[strsize - 1] = 0;" with strsize zero. OK,
if strsize is zero we don't have any filenames in stabs so no useful
info.
* syms.c (_bfd_stab_section_find_nearest_line): Exit if either
stabsize or strsize is zero.
diff --git a/bfd/syms.c b/bfd/syms.c
index ec62f3457ca..e8077f59bf0 100644
--- a/bfd/syms.c
+++ b/bfd/syms.c
@@ -1027,6 +1027,9 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
? info->strsec->rawsize
: info->strsec->size);
+ if (stabsize == 0 || strsize == 0)
+ goto out;
+
if (!bfd_malloc_and_get_section (abfd, info->stabsec, &info->stabs))
goto out;
if (!bfd_malloc_and_get_section (abfd, info->strsec, &info->strs))
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list