aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2012-12-09 18:01:39 +0000
committerH.J. Lu <hjl.tools@gmail.com>2012-12-09 18:01:39 +0000
commit35f0d396520eae5171f1ca089f38ca78b8882300 (patch)
treec9806355e7ca2123ff2e1a87cc356216d4ec153e /bfd
parent1b80a9fa753094ce0a6a4b3aa133c9b55e3c12ce (diff)
downloadgdb-35f0d396520eae5171f1ca089f38ca78b8882300.zip
gdb-35f0d396520eae5171f1ca089f38ca78b8882300.tar.gz
gdb-35f0d396520eae5171f1ca089f38ca78b8882300.tar.bz2
Properly check indicies bigger than 4Gb
PR binutils/14933 * archive.c (bsd_write_armap): Properly check indicies bigger than 4Gb.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/archive.c7
2 files changed, 9 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index b8fb291..9b286cf 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2012-12-09 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/14933
+ * archive.c (bsd_write_armap): Properly check indicies bigger
+ than 4Gb.
+
2012-12-07 Alan Modra <amodra@gmail.com>
PR ld/14926
diff --git a/bfd/archive.c b/bfd/archive.c
index 8e8fd2d..2fdc8b9 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -2424,9 +2424,6 @@ bsd_write_armap (bfd *arch,
unsigned int count;
struct ar_hdr hdr;
long uid, gid;
- file_ptr max_first_real = 1;
-
- max_first_real <<= 31;
firstreal = mapsize + elength + sizeof (struct ar_hdr) + SARMAG;
@@ -2469,6 +2466,7 @@ bsd_write_armap (bfd *arch,
for (count = 0; count < orl_count; count++)
{
+ unsigned int offset;
bfd_byte buf[BSD_SYMDEF_SIZE];
if (map[count].u.abfd != last_elt)
@@ -2488,7 +2486,8 @@ bsd_write_armap (bfd *arch,
/* 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)
+ offset = (unsigned int) firstreal;
+ if (firstreal != (file_ptr) offset)
{
bfd_set_error (bfd_error_file_truncated);
return FALSE;