public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Is there a fix for PR 12451
@ 2011-03-18 15:52 H.J. Lu
  2011-03-18 16:35 ` Nick Clifton
  0 siblings, 1 reply; 3+ messages in thread
From: H.J. Lu @ 2011-03-18 15:52 UTC (permalink / raw)
  To: Nick Clifton, Binutils

Hi Nick,

Is there is a fix for

http://www.sourceware.org/bugzilla/show_bug.cgi?id=12451

-- 
H.J.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Is there a fix for PR 12451
  2011-03-18 15:52 Is there a fix for PR 12451 H.J. Lu
@ 2011-03-18 16:35 ` Nick Clifton
  2011-03-18 16:42   ` H.J. Lu
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Clifton @ 2011-03-18 16:35 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Binutils

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;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Is there a fix for PR 12451
  2011-03-18 16:35 ` Nick Clifton
@ 2011-03-18 16:42   ` H.J. Lu
  0 siblings, 0 replies; 3+ messages in thread
From: H.J. Lu @ 2011-03-18 16:42 UTC (permalink / raw)
  To: Nick Clifton; +Cc: Binutils

On Fri, Mar 18, 2011 at 9:36 AM, Nick Clifton <nickc@redhat.com> wrote:
> Hi H.J.
>
>> Is there is a fix for
>> http://www.sourceware.org/bugzilla/show_bug.cgi?id=12451
>
> Does this patch fix it ?

Have you tried Jakub's testcase in the bug report?

Thanks.


H.J.
---
> 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;
>



-- 
H.J.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-03-18 16:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-18 15:52 Is there a fix for PR 12451 H.J. Lu
2011-03-18 16:35 ` Nick Clifton
2011-03-18 16:42   ` H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).