aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1999-11-09 19:13:21 +0000
committerIan Lance Taylor <ian@airs.com>1999-11-09 19:13:21 +0000
commit0bff3f4bb6e2ad90568897c3a233919f9b6bf51a (patch)
treecc100b3a1447fed264646eb697d1ffc4a0f3b936 /bfd
parenta8c5faf7f683b74bcca09a8efd7bff654677fb13 (diff)
downloadgdb-0bff3f4bb6e2ad90568897c3a233919f9b6bf51a.zip
gdb-0bff3f4bb6e2ad90568897c3a233919f9b6bf51a.tar.gz
gdb-0bff3f4bb6e2ad90568897c3a233919f9b6bf51a.tar.bz2
* libbfd.c (bfd_read): Check result of read against desired result
using !=, not <. (_bfd_generic_get_section_contents): Set bfd_error if the seek is invalid compared to the section size.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog10
-rw-r--r--bfd/libbfd.c23
2 files changed, 25 insertions, 8 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index a5a918e..a138c47 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,13 @@
+1999-11-09 Ian Lance Taylor <ian@zembu.com>
+
+ * libbfd.c (bfd_read): Check result of read against desired result
+ using !=, not <.
+ (_bfd_generic_get_section_contents): Set bfd_error if the seek is
+ invalid compared to the section size.
+
+ * ieee.c (ieee_slurp_debug): Get the length of the debug
+ information right if there is no data part.
+
Tue Nov 2 01:44:41 1999 Jeffrey A Law (law@cygnus.com)
* som.c (som_fixup_formats): Improve handling of R_AUX_UNWIND,
diff --git a/bfd/libbfd.c b/bfd/libbfd.c
index 9620cda..b43e88c 100644
--- a/bfd/libbfd.c
+++ b/bfd/libbfd.c
@@ -293,7 +293,7 @@ bfd_read (ptr, size, nitems, abfd)
A BFD backend may wish to override bfd_error_file_truncated to
provide something more useful (eg. no_symbols or wrong_format). */
- if (nread < (int)(size * nitems))
+ if (nread != (int) (size * nitems))
{
if (ferror (bfd_cache_lookup (abfd)))
bfd_set_error (bfd_error_system_call);
@@ -1166,13 +1166,20 @@ _bfd_generic_get_section_contents (abfd, section, location, offset, count)
file_ptr offset;
bfd_size_type count;
{
- if (count == 0)
- return true;
- if ((bfd_size_type)(offset+count) > section->_raw_size
- || bfd_seek(abfd, (file_ptr)(section->filepos + offset), SEEK_SET) == -1
- || bfd_read(location, (bfd_size_type)1, count, abfd) != count)
- return (false); /* on error */
- return (true);
+ if (count == 0)
+ return true;
+
+ if ((bfd_size_type) (offset + count) > section->_raw_size)
+ {
+ bfd_set_error (bfd_error_invalid_operation);
+ return false;
+ }
+
+ if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0
+ || bfd_read (location, (bfd_size_type) 1, count, abfd) != count)
+ return false;
+
+ return true;
}
boolean