aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2022-10-05 10:27:46 +1030
committerAlan Modra <amodra@gmail.com>2022-10-05 14:53:41 +1030
commit011a13613403c42717c623b0c5fc1e69de9f65b5 (patch)
tree99d04c683d74038b26d46c7a322cb5a2a22d4fa1
parent9c48ba47b36c3b243727af49bfebb867d7930de3 (diff)
downloadgdb-011a13613403c42717c623b0c5fc1e69de9f65b5.zip
gdb-011a13613403c42717c623b0c5fc1e69de9f65b5.tar.gz
gdb-011a13613403c42717c623b0c5fc1e69de9f65b5.tar.bz2
Re: stab nearest_line bfd_malloc_and_get_section
It didn't take long for the fuzzers to avoid size checks in bfd_malloc_and_get_section. Plug this hole. * syms.c (_bfd_stab_section_find_nearest_line): Ignore fuzzed sections with no contents.
-rw-r--r--bfd/syms.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/bfd/syms.c b/bfd/syms.c
index e8077f5..c9d27eb 100644
--- a/bfd/syms.c
+++ b/bfd/syms.c
@@ -1019,6 +1019,10 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
return true;
}
+ if ((info->stabsec->flags & SEC_HAS_CONTENTS) == 0
+ || (info->strsec->flags & SEC_HAS_CONTENTS) == 0)
+ goto out;
+
stabsize = (info->stabsec->rawsize
? info->stabsec->rawsize
: info->stabsec->size);