Check S-record with 0 size

* srec.c (srec_scan): Return error for 0 size.
This commit is contained in:
H.J. Lu 2014-08-28 08:22:42 -07:00
parent 7096e88625
commit 376c8d5bbb
2 changed files with 6 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2014-08-28 H.J. Lu <hongjiu.lu@intel.com>
* srec.c (srec_scan): Return error for 0 size.
2014-08-27 H.J. Lu <hongjiu.lu@intel.com>
PR ld/17306

View File

@ -486,7 +486,8 @@ srec_scan (bfd *abfd)
bufsize = bytes * 2;
}
if (bfd_bread (buf, (bfd_size_type) bytes * 2, abfd) != bytes * 2)
if (bytes == 0
|| bfd_bread (buf, (bfd_size_type) bytes * 2, abfd) != bytes * 2)
goto error_return;
/* Ignore the checksum byte. */