bfd_size_type count)
{
bfd_size_type sz;
- file_ptr filesz;
if (count == 0)
return TRUE;
sz = section->rawsize;
else
sz = section->size;
- filesz = bfd_get_file_size (abfd);
- if (filesz < 0)
- {
- /* This should never happen. */
- abort ();
- }
if (offset + count < count
|| offset + count > sz
- || (section->filepos + offset + count) > (bfd_size_type) filesz)
+ || (abfd->my_archive != NULL
+ && !bfd_is_thin_archive (abfd->my_archive)
+ && ((ufile_ptr) section->filepos + offset + count
+ > arelt_size (abfd))))
{
bfd_set_error (bfd_error_invalid_operation);
return FALSE;
{
#ifdef USE_MMAP
bfd_size_type sz;
- file_ptr filesz;
if (count == 0)
return TRUE;
sz = section->rawsize;
else
sz = section->size;
- filesz = bfd_get_file_size (abfd);
- if (filesz < 0)
- {
- /* This should never happen. */
- abort ();
- }
- if (offset + count > sz
- || (section->filepos + offset + sz) > (bfd_size_type) filesz
+ if (offset + count < count
+ || offset + count > sz
+ || (abfd->my_archive != NULL
+ && !bfd_is_thin_archive (abfd->my_archive)
+ && ((ufile_ptr) section->filepos + offset + count
+ > arelt_size (abfd)))
|| ! bfd_get_file_window (abfd, section->filepos + offset, count, w,
TRUE))
return FALSE;