[binutils-gdb] asan: null dereference in coff_count_linenumbers

Alan Modra amodra@sourceware.org
Sat Jun 4 11:28:07 GMT 2022


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3ae76967be4f05d9171e6e03cb298af648b52899

commit 3ae76967be4f05d9171e6e03cb298af648b52899
Author: Alan Modra <amodra@gmail.com>
Date:   Sat Jun 4 18:37:20 2022 +0930

    asan: null dereference in coff_count_linenumbers
    
            * coffgen.c (coff_count_linenumbers): Don't segfault when asymbol
            the_bfd is NULL.

Diff:
---
 bfd/coffgen.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index c693cfc00cb..07b3fb446aa 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -595,7 +595,8 @@ coff_count_linenumbers (bfd *abfd)
     {
       asymbol *q_maybe = *p;
 
-      if (bfd_family_coff (bfd_asymbol_bfd (q_maybe)))
+      if (bfd_asymbol_bfd (q_maybe) != NULL
+	  && bfd_family_coff (bfd_asymbol_bfd (q_maybe)))
 	{
 	  coff_symbol_type *q = coffsymbol (q_maybe);


More information about the Binutils-cvs mailing list