diff options
author | Ken Raeburn <raeburn@cygnus> | 1994-02-16 00:57:15 +0000 |
---|---|---|
committer | Ken Raeburn <raeburn@cygnus> | 1994-02-16 00:57:15 +0000 |
commit | aaa486c3d024c32be34313bb9ae30c4acc232d89 (patch) | |
tree | db47ac4516b848c36e2f35b7f7cecbcb971e5850 /bfd/section.c | |
parent | f550cec5b1461950b9f3bea04cb89263143171c5 (diff) | |
download | gdb-aaa486c3d024c32be34313bb9ae30c4acc232d89.zip gdb-aaa486c3d024c32be34313bb9ae30c4acc232d89.tar.gz gdb-aaa486c3d024c32be34313bb9ae30c4acc232d89.tar.bz2 |
(bfd_get_section_contents): Since this function reads unrelocated contents, the
section's raw size is always the one to use for bounds checking.
Diffstat (limited to 'bfd/section.c')
-rw-r--r-- | bfd/section.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/bfd/section.c b/bfd/section.c index 02ae218..373e7a0 100644 --- a/bfd/section.c +++ b/bfd/section.c @@ -887,10 +887,10 @@ DEFUN(bfd_get_section_contents,(abfd, section, location, offset, count), bfd_error = bad_value; return false; } - sz = bfd_get_section_size_now (abfd, section); - if (offset > sz - || count > sz - || offset + count > sz) + /* Even if reloc_done is true, this function reads unrelocated + contents, so we want the raw size. */ + sz = section->_raw_size; + if (offset > sz || count > sz || offset + count > sz) goto bad_val; if (count == 0) |