This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA:] Allow bfd_hash_lookup (bfd_get_section_by_name) in an emptybfd


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]