public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: "Martin Liška" <mliska@suse.cz>
Cc: binutils@sourceware.org
Subject: Re: pe_ILF_object_p and bfd_check_format_matches
Date: Thu, 13 Apr 2023 20:28:59 +0930	[thread overview]
Message-ID: <ZDfgc6h0ldWA/l7a@squeak.grove.modra.org> (raw)
In-Reply-To: <e8047f42-0358-dc98-4949-6b92a4dbd8e5@suse.cz>

On Thu, Apr 13, 2023 at 11:55:10AM +0200, Martin Liška wrote:
> On 4/13/23 04:58, Alan Modra via Binutils wrote:
> > |The last patch wasn't quite correct.|
> 
> Heh, I've just noticed that this change caused a crash when ar is called for ~150 files:
> 
> ==27734== Invalid read of size 4
> ==27734==    at 0x4D576DD: ftello (in /usr/lib64/libc.so.6)
> ==27734==    by 0x4958E18: close_one (in /usr/lib64/libbfd-2.40.50.20230412-797.so)

Yes, that will be this part:
> >    It is also not correct to restore abfd->iostream unless the iovec
> >    changes.  abfd->iostream is a FILE* when using cache_iovec, and if
> >    the file has been closed and reopened the iostream may have changed.

I saw a similar invalid read in fseeko, and a double free in fclose
due to the above.

-- 
Alan Modra
Australia Development Lab, IBM

  reply	other threads:[~2023-04-13 10:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-12  1:32 Alan Modra
2023-04-13  2:58 ` Alan Modra
2023-04-13  9:55   ` Martin Liška
2023-04-13 10:58     ` Alan Modra [this message]
2023-04-13 12:53       ` Martin Liška

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=ZDfgc6h0ldWA/l7a@squeak.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=mliska@suse.cz \
    /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).