Re: hash_string broken

From: Adrian Chadd <adrian@dont-contact.us>
Date: Mon, 4 Jun 2001 21:04:45 +0800

On Mon, Jun 04, 2001, Robert Collins wrote:
> I've logged a bugzilla entry on this, but we seem to have found a fault
> with hash_string:
>
> The string
> "cif_bm\\raffagli" in a hash of size 7921, sometimes gets inserted at
> 7482, and sometimes at 6475.
>
> There is a possibility that bucket 7482 is the correct one, and we're
> overwriting a correctly inserted key for a different user, multiple
> times, all coincidentally when the bucket is 6475.
>
> All our crashes are with this username, which could imply a problem with
> our code related to bucket 7482, but as the auth code doesn't see the
> bucket number, that is rather unlikely.
>
> On the other hand hash_string behaving non-deterministically is also
> rather unlikely... any pointers?

How about logging data/size and then n/j/i/i%size when you call
hash_string?

You might get some interesting results (eg the size might be changing
and you're including a terminating NULL or missing the last
character.)

Adrian

-- 
Adrian Chadd			"How could we possibly use sex to get
<adrian@creative.net.au>	  what we want?
			 	   Sex _IS_ what we want!" -- Fraser
Received on Mon Jun 04 2001 - 07:04:49 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:14:03 MST