Don't read beyond section end

* objcopy.c (copy_section): Don't read beyond section end.
This commit is contained in:
H.J. Lu 2012-11-07 06:16:26 +00:00
parent ddda4adc28
commit ee7da987c9
2 changed files with 9 additions and 1 deletions

View File

@ -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

View File

@ -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;