public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [RFA:] Allow bfd_hash_lookup (bfd_get_section_by_name) in an empty bfd
@ 2002-01-11 21:04 Hans-Peter Nilsson
  2002-01-12  6:24 ` Alan Modra
  0 siblings, 1 reply; 3+ messages in thread
From: Hans-Peter Nilsson @ 2002-01-11 21:04 UTC (permalink / raw)
  To: binutils

With some work in progress, I called bfd_get_section_by_name
with a bfd with no sections (presumably: yet).  It seems like
that should be valid, and not get a SIGFPE on the
"index = hash % table->size" further down.

Ok to commit?

	* hash.c (bfd_hash_lookup): Return NULL for an empty table.

Index: hash.c
===================================================================
RCS file: /cvs/src/src/bfd/hash.c,v
retrieving revision 1.6
diff -p -c -r1.6 hash.c
*** hash.c	2001/09/18 09:57:24	1.6
--- hash.c	2002/01/12 04:39:26
*************** bfd_hash_lookup (table, string, create,
*** 368,373 ****
--- 368,376 ----
    unsigned int len;
    unsigned int index;

+   if (table->size == 0)
+     return (struct bfd_hash_entry *) NULL;
+
    hash = 0;
    len = 0;
    s = (const unsigned char *) string;

brgds, H-P

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

* Re: [RFA:] Allow bfd_hash_lookup (bfd_get_section_by_name) in an empty bfd
  2002-01-11 21:04 [RFA:] Allow bfd_hash_lookup (bfd_get_section_by_name) in an empty bfd Hans-Peter Nilsson
@ 2002-01-12  6:24 ` Alan Modra
  2002-01-12 16:25   ` Hans-Peter Nilsson
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Modra @ 2002-01-12  6:24 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: binutils

On Fri, Jan 11, 2002 at 11:44:41PM -0500, Hans-Peter Nilsson wrote:
> With some work in progress, I called bfd_get_section_by_name
> with a bfd with no sections (presumably: yet).  It seems like
> that should be valid, and not get a SIGFPE on the
> "index = hash % table->size" further down.

Huh?  opncls.c:_bfd_new_bfd sets up the hash table.  How did you
manage this trick?

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

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

* Re: [RFA:] Allow bfd_hash_lookup (bfd_get_section_by_name) in an empty bfd
  2002-01-12  6:24 ` Alan Modra
@ 2002-01-12 16:25   ` Hans-Peter Nilsson
  0 siblings, 0 replies; 3+ messages in thread
From: Hans-Peter Nilsson @ 2002-01-12 16:25 UTC (permalink / raw)
  To: Alan Modra; +Cc: binutils

On Sat, 12 Jan 2002, Alan Modra wrote:
> On Fri, Jan 11, 2002 at 11:44:41PM -0500, Hans-Peter Nilsson wrote:
> > With some work in progress, I called bfd_get_section_by_name
> > with a bfd with no sections (presumably: yet).  It seems like
> > that should be valid, and not get a SIGFPE on the
> > "index = hash % table->size" further down.
>
> Huh?  opncls.c:_bfd_new_bfd sets up the hash table.  How did you
> manage this trick?

Sorry, bogus pointer referenced.  :-(
Request withdrawn :-)

brgds, H-P

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

end of thread, other threads:[~2002-01-12  5:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-11 21:04 [RFA:] Allow bfd_hash_lookup (bfd_get_section_by_name) in an empty bfd Hans-Peter Nilsson
2002-01-12  6:24 ` Alan Modra
2002-01-12 16:25   ` Hans-Peter Nilsson

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