[committed, PATCH] Check file size before getting section contents
H.J. Lu
hjl.tools@gmail.com
Mon Jun 26 23:27:00 GMT 2017
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.
More information about the Binutils
mailing list