public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Bug in xsym.c ?
@ 2003-03-05  9:03 Nick Clifton
  2003-03-08 19:55 ` Elias Athanasopoulos
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Clifton @ 2003-03-05  9:03 UTC (permalink / raw)
  To: kdienes; +Cc: binutils

Hi Klee,

  I ran across a problem compiling bfd/xsym.c on a Solaris platform
  the other day.  The function bfd_sym_fetch_type_information_table_ent()
  was testing a variable called 'index' which is not defined.  It was
  not clear from the context what the test was supposed to be doing,
  but my best guess was that it was intended to check that a parameter
  called 'entry' was non-NULL.

  I created a patch like this.  Is it correct ?

Cheers
        Nick


Index: bfd/xsym.c
===================================================================
RCS file: /cvs/src/src/bfd/xsym.c,v
retrieving revision 1.3
diff -c -3 -p -w -r1.3 xsym.c
*** bfd/xsym.c	30 Nov 2002 08:39:40 -0000	1.3
--- bfd/xsym.c	5 Mar 2003 08:59:48 -0000
*************** bfd_sym_fetch_type_information_table_ent
*** 1131,1137 ****
    BFD_ASSERT (bfd_sym_valid (abfd));
    sdata = abfd->tdata.sym_data;
  
!   if (index == 0)
      return -1;
  
    if (bfd_seek (abfd, offset, SEEK_SET) < 0)
--- 1131,1137 ----
    BFD_ASSERT (bfd_sym_valid (abfd));
    sdata = abfd->tdata.sym_data;
  
!   if (entry == 0)
      return -1;
  
    if (bfd_seek (abfd, offset, SEEK_SET) < 0)

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

* Re: Bug in xsym.c ?
  2003-03-05  9:03 Bug in xsym.c ? Nick Clifton
@ 2003-03-08 19:55 ` Elias Athanasopoulos
  2003-03-12  9:59   ` Nick Clifton
  0 siblings, 1 reply; 3+ messages in thread
From: Elias Athanasopoulos @ 2003-03-08 19:55 UTC (permalink / raw)
  To: Nick Clifton; +Cc: kdienes, binutils

Hi Nick, 

On Wed, Mar 05, 2003 at 09:05:25AM +0000, Nick Clifton wrote:
> Hi Klee,
> 
>   I ran across a problem compiling bfd/xsym.c on a Solaris platform
>   the other day.  The function bfd_sym_fetch_type_information_table_ent()
>   was testing a variable called 'index' which is not defined.  It was
>   not clear from the context what the test was supposed to be doing,
>   but my best guess was that it was intended to check that a parameter
>   called 'entry' was non-NULL.
> 
>   I created a patch like this.  Is it correct ?
>   
> !   if (entry == 0)
>       return -1;
>   
>     if (bfd_seek (abfd, offset, SEEK_SET) < 0)

I believe the test should be made against the 'offset' variable.

Although this is not a proof:

[anteater@neutrino bfd]$ grep bfd_sym_fetch_type_information_table_entry *.c
xsym.c:bfd_sym_fetch_type_information_table_entry (abfd, entry, offset)
xsym.c:  if (bfd_sym_fetch_type_information_table_entry (abfd, entry, tindex) < 0)
xsym.c:   if (bfd_sym_fetch_type_information_table_entry (abfd, &entry, index) < 0)

As I understand it, 'offset' should have been named 'index'.

Elias

-- 
University of Athens			I bet the human brain 
Physics Department				is a kludge --Marvin Minsky 

	

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

* Re: Bug in xsym.c ?
  2003-03-08 19:55 ` Elias Athanasopoulos
@ 2003-03-12  9:59   ` Nick Clifton
  0 siblings, 0 replies; 3+ messages in thread
From: Nick Clifton @ 2003-03-12  9:59 UTC (permalink / raw)
  To: Elias Athanasopoulos; +Cc: kdienes, binutils

Hi Elias,

> I believe the test should be made against the 'offset' variable.
> 
> Although this is not a proof:
> 
> [anteater@neutrino bfd]$ grep bfd_sym_fetch_type_information_table_entry *.c
> xsym.c:bfd_sym_fetch_type_information_table_entry (abfd, entry, offset)
> xsym.c:  if (bfd_sym_fetch_type_information_table_entry (abfd, entry, tindex) < 0)
> xsym.c:   if (bfd_sym_fetch_type_information_table_entry (abfd, &entry, index) < 0)
> 
> As I understand it, 'offset' should have been named 'index'.

Seems fair enough.  Klee has not responded, so I have checked in a
patch to rename 'entry' to 'offset'.

Cheers
         Nick

2003-03-12  Nick Clifton  <nickc@redhat.com>

	* xsym.c (bfd_sym_fetch_type_information_table_entry): Change
	'entry' to 'offset' in test for zero value.


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

end of thread, other threads:[~2003-03-12  9:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-05  9:03 Bug in xsym.c ? Nick Clifton
2003-03-08 19:55 ` Elias Athanasopoulos
2003-03-12  9:59   ` Nick Clifton

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