This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Is there a fix for PR 12451
Hi H.J.
Is there is a fix for
http://www.sourceware.org/bugzilla/show_bug.cgi?id=12451
Does this patch fix it ?
Cheers
Nick
Index: bfd/compress.c
===================================================================
RCS file: /cvs/src/src/bfd/compress.c,v
retrieving revision 1.8
diff -u -3 -p -r1.8 compress.c
--- bfd/compress.c 6 Mar 2011 18:37:07 -0000 1.8
+++ bfd/compress.c 18 Mar 2011 16:35:09 -0000
@@ -177,7 +177,7 @@ bfd_get_full_section_contents (bfd *abfd
case COMPRESS_SECTION_NONE:
if (p == NULL)
{
- p = (bfd_byte *) bfd_malloc (sz);
+ p = (bfd_byte *) bfd_zmalloc (sz);
if (p == NULL)
return FALSE;
}
@@ -217,7 +217,7 @@ bfd_get_full_section_contents (bfd *abfd
if (!ret)
goto fail_compressed;
- uncompressed_buffer = (bfd_byte *) bfd_malloc (uncompressed_size);
+ uncompressed_buffer = (bfd_byte *) bfd_zmalloc (uncompressed_size);
if (uncompressed_buffer == NULL)
goto fail_compressed;
Index: bfd/elfcode.h
===================================================================
RCS file: /cvs/src/src/bfd/elfcode.h,v
retrieving revision 1.105
diff -u -3 -p -r1.105 elfcode.h
--- bfd/elfcode.h 14 Mar 2011 15:54:58 -0000 1.105
+++ bfd/elfcode.h 18 Mar 2011 16:35:09 -0000
@@ -1159,6 +1159,24 @@ elf_checksum_contents (bfd *abfd,
if (i_shdr.contents)
(*process) (i_shdr.contents, i_shdr.sh_size, arg);
+ else
+ {
+ asection *sec;
+
+ sec = bfd_section_from_elf_index (abfd, count);
+ if (sec != NULL)
+ {
+ if (sec->contents == NULL)
+ {
+ /* Force rereading from file. */
+ sec->flags &= ~SEC_IN_MEMORY;
+ if (! bfd_malloc_and_get_section (abfd, sec, & sec->contents))
+ continue;
+ }
+ if (sec->contents != NULL)
+ (*process) (sec->contents, i_shdr.sh_size, arg);
+ }
+ }
}
return TRUE;