public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* asan: null deref in coff_write_relocs
@ 2022-06-02  7:39 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2022-06-02  7:39 UTC (permalink / raw)
  To: binutils

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

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-02  7:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-02  7:39 asan: null deref in coff_write_relocs Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).