public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [patch] guard against null, coffgen.c
@ 2007-07-26  1:49 msnyder
  2007-07-26 14:07 ` Alan Modra
  0 siblings, 1 reply; 3+ messages in thread
From: msnyder @ 2007-07-26  1:49 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 178 bytes --]

Unlike some of the other macros, bfd_is_common_section dereferences
the section pointer.  Since we later check it for NULL, we ought to
do so here too, before dereferencing it.


[-- Attachment #2: coffgen4.txt --]
[-- Type: text/plain, Size: 1047 bytes --]

2007-07-25  Michael Snyder  <msnyder@svkmacdonelllnx>

	* coffgen.c (fixup_symbol_value): Guard against null; 
	bfd_is_com_section will dereference the section pointer.

Index: coffgen.c
===================================================================
RCS file: /cvs/src/src/bfd/coffgen.c,v
retrieving revision 1.59
diff -p -r1.59 coffgen.c
*** coffgen.c	12 Jul 2007 07:16:40 -0000	1.59
--- coffgen.c	26 Jul 2007 01:45:25 -0000
*************** fixup_symbol_value (bfd *abfd,
*** 562,568 ****
  		    struct internal_syment *syment)
  {
    /* Normalize the symbol flags.  */
!   if (bfd_is_com_section (coff_symbol_ptr->symbol.section))
      {
        /* A common symbol is undefined with a value.  */
        syment->n_scnum = N_UNDEF;
--- 567,574 ----
  		    struct internal_syment *syment)
  {
    /* Normalize the symbol flags.  */
!   if (coff_symbol_ptr->symbol.section 
!       && bfd_is_com_section (coff_symbol_ptr->symbol.section))
      {
        /* A common symbol is undefined with a value.  */
        syment->n_scnum = N_UNDEF;

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

* Re: [patch] guard against null, coffgen.c
  2007-07-26  1:49 [patch] guard against null, coffgen.c msnyder
@ 2007-07-26 14:07 ` Alan Modra
  2007-07-26 19:11   ` msnyder
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Modra @ 2007-07-26 14:07 UTC (permalink / raw)
  To: msnyder; +Cc: binutils

On Wed, Jul 25, 2007 at 06:48:44PM -0700, msnyder@sonic.net wrote:
> 	* coffgen.c (fixup_symbol_value): Guard against null; 
> 	bfd_is_com_section will dereference the section pointer.

OK.

-- 
Alan Modra
Australia Development Lab, IBM

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

* Re: [patch] guard against null, coffgen.c
  2007-07-26 14:07 ` Alan Modra
@ 2007-07-26 19:11   ` msnyder
  0 siblings, 0 replies; 3+ messages in thread
From: msnyder @ 2007-07-26 19:11 UTC (permalink / raw)
  To: binutils

> On Wed, Jul 25, 2007 at 06:48:44PM -0700, msnyder@sonic.net wrote:
>> 	* coffgen.c (fixup_symbol_value): Guard against null;
>> 	bfd_is_com_section will dereference the section pointer.
>
> OK.

Thanks - committed.


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

end of thread, other threads:[~2007-07-26 19:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-26  1:49 [patch] guard against null, coffgen.c msnyder
2007-07-26 14:07 ` Alan Modra
2007-07-26 19:11   ` msnyder

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).