diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2012-11-07 06:16:25 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2012-11-07 06:16:25 +0000 |
commit | 2c06122590e4defed3a2bfad223cc67c6a4236dc (patch) | |
tree | 620665726369807521de153432daed56fc928544 | |
parent | d80105584abc1869886419c62cd63512506af126 (diff) | |
download | binutils-2c06122590e4defed3a2bfad223cc67c6a4236dc.tar.gz |
Don't read beyond section end
* objcopy.c (copy_section): Don't read beyond section end.
-rw-r--r-- | binutils/ChangeLog | 4 | ||||
-rw-r--r-- | binutils/objcopy.c | 6 |
2 files changed, 9 insertions, 1 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 84ea185c4..688d569d8 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,7 @@ +2012-11-07 H.J. Lu <hongjiu.lu@intel.com> + + * objcopy.c (copy_section): Don't read beyond section end. + 2012-11-06 H.J. Lu <hongjiu.lu@intel.com> PR binutils/14567 diff --git a/binutils/objcopy.c b/binutils/objcopy.c index f44ebcd94..486086467 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -2823,7 +2823,11 @@ copy_section (bfd *ibfd, sec_ptr isection, void *obfdarg) for (; from < end; from += interleave) for (i = 0; i < copy_width; i++) - *to++ = from[i]; + { + if (&from[i] >= end) + break; + *to++ = from[i]; + } size = (size + interleave - 1 - copy_byte) / interleave * copy_width; osection->lma /= interleave; |