public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* asan: Invalid free in alpha_ecoff_get_relocated_section_contents
@ 2023-10-17  4:50 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2023-10-17  4:50 UTC (permalink / raw)
  To: binutils

This fixes an ancient bug in commit a3a33af390 (which makes me think
this code has never been used).  There is a "free (reloc_vector)"
after the end of the loop.

	* coff-alpha.c (alpha_ecoff_get_relocated_section_contents): Iterate
	through reloc_vector using a temp.

diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c
index 1b34a8957c2..59476b57237 100644
--- a/bfd/coff-alpha.c
+++ b/bfd/coff-alpha.c
@@ -810,13 +810,13 @@ alpha_ecoff_get_relocated_section_contents (bfd *abfd,
 	}
     }
 
-  for (; *reloc_vector != (arelent *) NULL; reloc_vector++)
+  for (arelent **relp = reloc_vector; *relp != NULL; relp++)
     {
       arelent *rel;
       bfd_reloc_status_type r;
       char *err;
 
-      rel = *reloc_vector;
+      rel = *relp;
       r = bfd_reloc_ok;
       switch (rel->howto->type)
 	{

-- 
Alan Modra
Australia Development Lab, IBM

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

only message in thread, other threads:[~2023-10-17  4:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-17  4:50 asan: Invalid free in alpha_ecoff_get_relocated_section_contents 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).