asan: null deref in coff_write_relocs

* coffcode.h (coff_write_relocs): Don't deref NULL howto.
This commit is contained in:
Alan Modra
2022-06-02 16:31:42 +09:30
parent e0ad09cfa5
commit f66d30a6e5

View File

@ -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);