This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Debug info read problem
On Thu, Mar 12, 2009 at 12:57:52PM -0400, Daniel Jacobowitz wrote:
> I took a look at bfd_simple_get_relocated_section_contents, which is
> providing the buffer. If the section does not have relocations, it
> uses rawsize if set and otherwise size. If it does have relocations,
> it uses just sec->size.
Fixed. Only matters of course if the target *increases* the size of a
section. This isn't very likely with most targets that support linker
relaxation, but it is possible, eg. mmix.
* simple.c (bfd_simple_get_relocated_section_contents): Use larger
of rawsize and size for buffer.
Index: bfd/simple.c
===================================================================
RCS file: /cvs/src/src/bfd/simple.c,v
retrieving revision 1.30
diff -u -p -r1.30 simple.c
--- bfd/simple.c 16 Feb 2008 23:00:12 -0000 1.30
+++ bfd/simple.c 16 Mar 2009 00:38:53 -0000
@@ -210,7 +210,8 @@ bfd_simple_get_relocated_section_content
data = NULL;
if (outbuf == NULL)
{
- data = bfd_malloc (sec->size);
+ bfd_size_type amt = sec->rawsize > sec->size ? sec->rawsize : sec->size;
+ data = bfd_malloc (amt);
if (data == NULL)
return NULL;
outbuf = data;
--
Alan Modra
Australia Development Lab, IBM