aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2014-08-28 08:22:42 -0700
committerH.J. Lu <hjl.tools@gmail.com>2014-08-28 08:24:19 -0700
commit376c8d5bbb7e31987e363ee4c481ae8ff5015a77 (patch)
tree2b1e3062c62fbb03cf163bfa326b342eb0c629bd /bfd
parent7096e886259fad196b955ecaff9a61891281d117 (diff)
downloadgdb-376c8d5bbb7e31987e363ee4c481ae8ff5015a77.zip
gdb-376c8d5bbb7e31987e363ee4c481ae8ff5015a77.tar.gz
gdb-376c8d5bbb7e31987e363ee4c481ae8ff5015a77.tar.bz2
Check S-record with 0 size
* srec.c (srec_scan): Return error for 0 size.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog4
-rw-r--r--bfd/srec.c3
2 files changed, 6 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index bba079f..6484c91 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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
diff --git a/bfd/srec.c b/bfd/srec.c
index f11e74a..d979bf5 100644
--- a/bfd/srec.c
+++ b/bfd/srec.c
@@ -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. */