public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@sourceware.org>
To: bfd-cvs@sourceware.org
Subject: [binutils-gdb/binutils-2_40-branch] coff_get_normalized_symtab bfd_release
Date: Wed, 22 Mar 2023 00:15:49 +0000 (GMT)	[thread overview]
Message-ID: <20230322001549.057933858D38@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=165accf07523db070eb25866a614b9a8f9c8e281

commit 165accf07523db070eb25866a614b9a8f9c8e281
Author: Alan Modra <amodra@gmail.com>
Date:   Wed Mar 22 10:13:46 2023 +1030

    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)

Diff:
---
 bfd/coffgen.c | 5 +----
 1 file changed, 1 insertion(+), 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;

                 reply	other threads:[~2023-03-22  0:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230322001549.057933858D38@sourceware.org \
    --to=amodra@sourceware.org \
    --cc=bfd-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).