diff options
author | Alan Modra <amodra@gmail.com> | 2023-03-22 10:13:46 +1030 |
---|---|---|
committer | Andreas K. Hüttel <dilfridge@gentoo.org> | 2023-04-02 13:50:54 +0200 |
commit | c450a3ac9a3b39dcff66597bf0d0abd4fa8b1603 (patch) | |
tree | 4b1d924cfd7799ce14135200f8e05d7a9391c36f | |
parent | PR30217, dynamic relocations using local dynamic symbols (diff) | |
download | binutils-gdb-c450a3ac9a3b39dcff66597bf0d0abd4fa8b1603.tar.gz binutils-gdb-c450a3ac9a3b39dcff66597bf0d0abd4fa8b1603.tar.bz2 binutils-gdb-c450a3ac9a3b39dcff66597bf0d0abd4fa8b1603.zip |
coff_get_normalized_symtab bfd_release
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.
(cherry picked from commit bcefc6be9754d45fb9391993e6daaf01a68d9bd5)
(cherry picked from commit 165accf07523db070eb25866a614b9a8f9c8e281)
-rw-r--r-- | bfd/coffgen.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/bfd/coffgen.c b/bfd/coffgen.c index 74636a9e305..e9455c82a33 100644 --- a/bfd/coffgen.c +++ b/bfd/coffgen.c @@ -1756,10 +1756,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; |