asan: null dereference in coff_count_linenumbers
authorAlan Modra <amodra@gmail.com>
Sat, 4 Jun 2022 09:07:20 +0000 (18:37 +0930)
committerAlan Modra <amodra@gmail.com>
Sat, 4 Jun 2022 11:27:36 +0000 (20:57 +0930)
* coffgen.c (coff_count_linenumbers): Don't segfault when asymbol
the_bfd is NULL.

bfd/coffgen.c

index c693cfc00cb5a140f950b8fada71e21ffa016b5d..07b3fb446aa28d9f4e1719df05d3e2b9d22e8959 100644 (file)
@@ -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);