* coff_get_normalized_symtab bfd_release
@ 2023-03-22 0:13 Alan Modra
0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2023-03-22 0:13 UTC (permalink / raw)
To: binutils
We can't free "internal" on errors, since bfd_coff_swap_sym_in may
call bfd_alloc. For example, _bfd_XXi_swap_sym_in may even create new
sections, which use bfd_alloc'd memory. If "internal" is freed, all
more recently bfd_alloc'd memory is also freed.
* coffgen.c (coff_get_normalized_symtab): Don't bfd_release on
error.
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index 774edf76f24..0b764b0c45f 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -1753,10 +1753,7 @@ coff_get_normalized_symtab (bfd *abfd)
/* PR 17512: Prevent buffer overrun. */
if (symbol_ptr->u.syment.n_numaux > ((raw_end - 1) - raw_src) / symesz)
- {
- bfd_release (abfd, internal);
- return NULL;
- }
+ return NULL;
for (i = 0;
i < symbol_ptr->u.syment.n_numaux;
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-03-22 0:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-22 0:13 coff_get_normalized_symtab bfd_release 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).