http://sourceware.org/bugzilla/show_bug.cgi?id=14933

             Bug #: 14933
           Summary: ar & ranlib generate truncated files on 32bit
                    platform.
           Product: binutils
           Version: 2.23
            Status: NEW
          Severity: normal
          Priority: P2
         Component: binutils
        AssignedTo: unassig...@sourceware.org
        ReportedBy: al...@fairlite.co.uk
    Classification: Unclassified


Hi,

Just moved from binutils 2.22 to 2.23 and ar & ranlib generated bad archives
with the message "file truncated".

Looking into the problem reveals that in archive.c we have at around line
2414....

file_ptr firstreal;
....
file_ptr max_first_real;

max_first_real <<= 31;

then later we do....

      /* The archive file format only has 4 bytes to store the offset
         of the member.  Check to make sure that firstreal has not grown
         too big.  */
      if (firstreal >= max_first_real)
        {
          bfd_set_error (bfd_error_file_truncated);
          return FALSE;
        }

I added a check that did this in the errored function.

printf("CHECK %d %d (%d)\n",firstreal,max_first_real,sizeof(file_ptr));

It came back with....

CHECK 104 -2147483648 (4)

So, shouldn't firstreal/max_first_real be ufile_ptr's ?

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to