]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
strip.c (relocate): Make offset check overflow-proof.
authorMark Wielaard <mjw@redhat.com>
Mon, 30 May 2011 15:23:57 +0000 (17:23 +0200)
committerMark Wielaard <mjw@redhat.com>
Mon, 30 May 2011 15:23:57 +0000 (17:23 +0200)
src/ChangeLog
src/strip.c

index 007236a4c8312f1bf58c982695ca55ec563c2100..cb00bb04d5c257cd1c0b75858b37594bc02f6b69 100644 (file)
@@ -1,3 +1,7 @@
+2011-05-30  Mark Wielaard  <mjw@redhat.com>
+
+       * strip.c (relocate): Make offset check overflow-proof.
+
 2011-05-23  Mark Wielaard  <mjw@redhat.com>
 
        * strip.c (relocate): Take new arguments is_rela to indicate
index cf6bd971a5459ef7e6c78c310da1427ac88c3ccd..f135e7c96b2faade20da13ee0934af487efc5140 100644 (file)
@@ -1727,7 +1727,8 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname,
                        return false;
                      }
 
-                   if (offset + size > tdata->d_size)
+                   if (offset > tdata->d_size
+                       || tdata->d_size - offset < size)
                      error (0, 0, gettext ("bad relocation"));
 
                    /* When the symbol value is zero then for SHT_REL