aboutsummaryrefslogtreecommitdiff
path: root/bfd/section.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/section.c')
-rw-r--r--bfd/section.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/bfd/section.c b/bfd/section.c
index bff8adf..65ac5e6 100644
--- a/bfd/section.c
+++ b/bfd/section.c
@@ -1,6 +1,6 @@
/* Object file "section" support for the BFD library.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -1456,7 +1456,10 @@ bfd_get_section_contents (bfd *abfd,
return TRUE;
}
- sz = section->rawsize ? section->rawsize : section->size;
+ if (abfd->direction != write_direction && section->rawsize != 0)
+ sz = section->rawsize;
+ else
+ sz = section->size;
if ((bfd_size_type) offset > sz
|| count > sz
|| offset + count > sz