From 3ae76967be4f05d9171e6e03cb298af648b52899 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Sat, 4 Jun 2022 18:37:20 +0930 Subject: [PATCH] asan: null dereference in coff_count_linenumbers * coffgen.c (coff_count_linenumbers): Don't segfault when asymbol the_bfd is NULL. --- 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); -- 2.30.2