This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH: Check S-record with 0 size
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: binutils at sourceware dot org
- Date: Thu, 28 Aug 2014 08:25:34 -0700
- Subject: PATCH: Check S-record with 0 size
- Authentication-results: sourceware.org; auth=none
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Hi,
I checked in this patch to fix S-record with 0 size reported at
http://lists.gnu.org/archive/html/bug-binutils/2014-08/msg00110.html
H.J.
---
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. */