From: Mark Wielaard Date: Mon, 30 May 2011 15:23:57 +0000 (+0200) Subject: strip.c (relocate): Make offset check overflow-proof. X-Git-Tag: elfutils-0.153~36 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=02a958bc2662c1c9c2d6b663742b9c8e720e25b2;p=thirdparty%2Felfutils.git strip.c (relocate): Make offset check overflow-proof. --- diff --git a/src/ChangeLog b/src/ChangeLog index 007236a4c..cb00bb04d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2011-05-30 Mark Wielaard + + * strip.c (relocate): Make offset check overflow-proof. + 2011-05-23 Mark Wielaard * strip.c (relocate): Take new arguments is_rela to indicate diff --git a/src/strip.c b/src/strip.c index cf6bd971a..f135e7c96 100644 --- a/src/strip.c +++ b/src/strip.c @@ -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