This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: A question about display_archive in binutils
- From: Nick Clifton <nickc at redhat dot com>
- To: Nan Xiao <xiaonan830818 at gmail dot com>
- Cc: binutils at sourceware dot org
- Date: Wed, 18 Oct 2017 15:17:53 +0100
- Subject: Re: A question about display_archive in binutils
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=nickc at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9E9B2820FB
- References: <CA+MhoaMzRMh7+u1vaDb9nP0GcQJfQcuiUzPm0fxmKncTgywzaQ@mail.gmail.com>
Hi Nan Xiao,
> Greetings from me!
Hi! :-)
> if (last_arfile != NULL)
> - bfd_close (last_arfile);
> + {
> + bfd_close (last_arfile);
> +
> + /* PR 17512: file: a244edbc. */
> + if (last_arfile == arfile)
> + return;
> + }
>
> I am a little confused why there will occur last_arfile is equal
> to arfile. So it means bfd_openr_next_archived_file allocates the
> same memory in 2 consecutive times?
That is correct. If the input file is a corrupt archive then it can
confuse the code in bfd_openr_next_archived_file and so the same BFD
can be returned multiple times. Try running size or nm with the file
referenced in the comment to see this happening.
Cheers
Nick