From: Alan Modra Date: Thu, 2 Jun 2022 07:01:42 +0000 (+0930) Subject: asan: null deref in coff_write_relocs X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f66d30a6e5b9287f9edaa93e9f04db1fd44a06ce;p=binutils-gdb.git asan: null deref in coff_write_relocs * coffcode.h (coff_write_relocs): Don't deref NULL howto. --- diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 36e07025c6a..6de6ecdea39 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -2690,9 +2690,11 @@ coff_write_relocs (bfd * abfd, int first_undef) #ifdef SELECT_RELOC /* Work out reloc type from what is required. */ - SELECT_RELOC (n, q->howto); + if (q->howto) + SELECT_RELOC (n, q->howto); #else - n.r_type = q->howto->type; + if (q->howto) + n.r_type = q->howto->type; #endif coff_swap_reloc_out (abfd, &n, &dst);