Inconsistent .eh_frame_hdr on powerpc64
[deliverable/binutils-gdb.git] / bfd / libbfd.c
index b8c65b5e521cbe16b4b964d35031080cdd2d7666..2a49b61d2b441306c55f8683c7a380553263432a 100644 (file)
@@ -789,7 +789,6 @@ _bfd_generic_get_section_contents (bfd *abfd,
                                   bfd_size_type count)
 {
   bfd_size_type sz;
-  file_ptr filesz;
   if (count == 0)
     return TRUE;
 
@@ -812,15 +811,12 @@ _bfd_generic_get_section_contents (bfd *abfd,
     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;
@@ -843,7 +839,6 @@ _bfd_generic_get_section_contents_in_window
 {
 #ifdef USE_MMAP
   bfd_size_type sz;
-  file_ptr filesz;
 
   if (count == 0)
     return TRUE;
@@ -876,14 +871,12 @@ _bfd_generic_get_section_contents_in_window
     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;
This page took 0.02404 seconds and 4 git commands to generate.