aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2022-09-28 09:52:22 +0930
committerAlan Modra <amodra@gmail.com>2022-09-28 10:27:07 +0930
commit8e4a500a5c4cef1aafc2c6e47cadd3dea0bfb99b (patch)
tree9873de9c52888e58fe2efe3b803c5445c9543424 /bfd
parent540e53422cd8916b85d43060210251132fba8548 (diff)
downloadgdb-8e4a500a5c4cef1aafc2c6e47cadd3dea0bfb99b.zip
gdb-8e4a500a5c4cef1aafc2c6e47cadd3dea0bfb99b.tar.gz
gdb-8e4a500a5c4cef1aafc2c6e47cadd3dea0bfb99b.tar.bz2
asan: _bfd_stab_section_find_nearest_line segv
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.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/syms.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/bfd/syms.c b/bfd/syms.c
index ec62f34..e8077f5 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))