This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [committed, PATCH] Check file size before getting section contents


On Mon, Jun 26, 2017 at 4:15 PM, Alan Modra <amodra@gmail.com> wrote:
> On Mon, Jun 26, 2017 at 03:49:12PM -0700, H.J. Lu wrote:
>>    filesz = bfd_get_file_size (abfd);
>> +  if (filesz < 0)
>>      {
>>        /* This should never happen.  */
>>        abort ();
>
> This will abort for 2G files on some host/target combinations.  Why is
> that correct?
>

That is true.  The problem is

file_ptr
bfd_get_size (bfd *abfd)
{
  struct stat buf;

  if (abfd->iovec == NULL)
    return 0;

  if (abfd->iovec->bstat (abfd, &buf) != 0)
    return 0;

  return buf.st_size;
}

Why isn't it "ufile_ptr".

-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]