public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [patch] coffgen.c, degenerate case
@ 2007-07-25 23:45 msnyder
       [not found] ` <xnfy3c557p.fsf@greed.delorie.com>
  0 siblings, 1 reply; 3+ messages in thread
From: msnyder @ 2007-07-25 23:45 UTC (permalink / raw)
  To: binutils

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

If size == 0 and bfd_malloc returns NULL, just return.
No actual work to do anyway, and avoids passing null ptr to bfd_bread.


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

2007-07-25  Michael Snyder  <msnyder@access-company.com>

	* coffgen.c (_bfd_coff_get_external_symbols): Nothing to be done
	if size == 0; return and avoid possible null pointer issues.

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	25 Jul 2007 23:30:25 -0000
*************** _bfd_coff_get_external_symbols (bfd *abf
*** 1446,1453 ****
    size = obj_raw_syment_count (abfd) * symesz;
  
    syms = bfd_malloc (size);
!   if (syms == NULL && size != 0)
!     return FALSE;
  
    if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0
        || bfd_bread (syms, size, abfd) != size)
--- 1446,1456 ----
    size = obj_raw_syment_count (abfd) * symesz;
  
    syms = bfd_malloc (size);
!   if (syms == NULL)
!     if (size == 0)
!       return TRUE;
!     else
!       return FALSE;
  
    if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0
        || bfd_bread (syms, size, abfd) != size)

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

* Re: [patch] coffgen.c, degenerate case
       [not found]   ` <22417.12.7.175.2.1185413421.squirrel@webmail.sonic.net>
@ 2007-07-26  1:59     ` DJ Delorie
  2007-07-26  2:19       ` msnyder
  0 siblings, 1 reply; 3+ messages in thread
From: DJ Delorie @ 2007-07-26  1:59 UTC (permalink / raw)
  To: msnyder; +Cc: binutils


This is OK.

> 2007-07-25  Michael Snyder  <msnyder@access-company.com>
> 
> 	* coffgen.c (_bfd_coff_get_external_symbols): Nothing to be done
> 	if size == 0; return and avoid possible null pointer issues.
> 
> 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:27:09 -0000
> *************** _bfd_coff_get_external_symbols (bfd *abf
> *** 1444,1452 ****
>     symesz = bfd_coff_symesz (abfd);
>   
>     size = obj_raw_syment_count (abfd) * symesz;
>   
>     syms = bfd_malloc (size);
> !   if (syms == NULL && size != 0)
>       return FALSE;
>   
>     if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0
> --- 1449,1459 ----
>     symesz = bfd_coff_symesz (abfd);
>   
>     size = obj_raw_syment_count (abfd) * symesz;
> +   if (size == 0)
> +     return TRUE;
>   
>     syms = bfd_malloc (size);
> !   if (syms == NULL)
>       return FALSE;
>   
>     if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0
> ------=_20070725183021_75864--
> 
> 

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

* Re: [patch] coffgen.c, degenerate case
  2007-07-26  1:59     ` DJ Delorie
@ 2007-07-26  2:19       ` msnyder
  0 siblings, 0 replies; 3+ messages in thread
From: msnyder @ 2007-07-26  2:19 UTC (permalink / raw)
  To: DJ Delorie; +Cc: msnyder, binutils

>
> This is OK.

Committed, thanks.

By the way, I hope I'm not making you guys too crazy with all the
patches.  I'll be taking a break from it now.   ;-)



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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-25 23:45 [patch] coffgen.c, degenerate case msnyder
     [not found] ` <xnfy3c557p.fsf@greed.delorie.com>
     [not found]   ` <22417.12.7.175.2.1185413421.squirrel@webmail.sonic.net>
2007-07-26  1:59     ` DJ Delorie
2007-07-26  2:19       ` 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).