PR binutils/15157
authorNick Clifton <nickc@redhat.com>
Fri, 22 Mar 2013 16:04:55 +0000 (16:04 +0000)
committerNick Clifton <nickc@redhat.com>
Fri, 22 Mar 2013 16:04:55 +0000 (16:04 +0000)
* readelf.c (apply_relocations): Catch relocations with negative
offsets.

binutils/ChangeLog
binutils/readelf.c

index 43f490f20d412281b3ed7fda2dacef49758f3c83..e71ec4feaed11954f61b162fd6e96d6de004662f 100644 (file)
@@ -1,3 +1,9 @@
+2013-03-22  Nick Clifton  <nickc@redhat.com>
+
+       PR binutils/15157
+       * readelf.c (apply_relocations): Catch relocations with negative
+       offsets.
+
 2013-03-15  Nick Clifton  <nickc@redhat.com>
 
        * addr2line.c (slurp_symtab): If canonicalization reveals that
index 266e37e792414c10c85492146bcd49be8eee6b54..a7831ef51010c9019626815c2f526a5404e48472 100644 (file)
@@ -10517,7 +10517,7 @@ apply_relocations (void * file,
            }
 
          rloc = start + rp->r_offset;
-         if ((rloc + reloc_size) > end)
+         if ((rloc + reloc_size) > end || (rloc < start))
            {
              warn (_("skipping invalid relocation offset 0x%lx in section %s\n"),
                    (unsigned long) rp->r_offset,