https://sourceware.org/bugzilla/show_bug.cgi?id=16803
Bug ID: 16803
Summary: 32-bit linker fails on large file with “File
truncated” message
Product: binutils
Version: 2.25 (HEAD)
Status: NEW
Severity: normal
Priority: P2
Component: ld
Assignee: unassigned at sourceware dot org
Reporter: m.guseva at samsung dot com
Created attachment 7524
--> https://sourceware.org/bugzilla/attachment.cgi?id=7524&action=edit
Proposed patch
While linking large file (~2 Gb) with 32-bit ld the following error occurre
d:
ld: final link failed: File truncated
Linking the same with 64-bit linker is fine.
The failure happened due to call of bfd_seek() function with incorrect nega
tive
value of argument "position". The "position" value is incorrectly calculat
ed
in _bfd_elf_set_section_contents() with overflow in local variable of type
long:
bfd_signed_vma pos;
[...]
pos = hdr->sh_offset + offset;
if (bfd_seek (abfd, pos, SEEK_SET) != 0
Both terms of this calculation are of type long long. The result value also
is
used as long long argument in bfd_seek() call. Using the signed 32-bit type
for intermediate result seems to be a bug and causes incorrect processing of
large files.
Proposed patch is attached.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-binutils