Merge next-mr -> next-4284.

Fix Bug#50555 "handler commands crash server in my_hash_first()"
as a post-merge fix (the new handler tests are not passing 
otherwise).
- in hash.c, don't call calc_hash if ! my_hash_inited().
- add tests and results for the test case for Bug#50555


mysys/hash.c:
  Assert that the hash is initialized when it's used.
sql/set_var.cc:
  Check that the hash is initalized before using it (Bug#50555)
This commit is contained in:
Konstantin Osipov 2010-02-02 16:58:15 +03:00
commit a6daa9ada0
118 changed files with 5128 additions and 1809 deletions

View file

@ -232,6 +232,8 @@ my_hash_value_type my_calc_hash(const HASH *hash,
{
return calc_hash(hash, key, length ? length : hash->key_length);
}
/*
Search after a record based on a key
@ -242,11 +244,17 @@ my_hash_value_type my_calc_hash(const HASH *hash,
uchar* my_hash_first(const HASH *hash, const uchar *key, size_t length,
HASH_SEARCH_STATE *current_record)
{
return my_hash_first_from_hash_value(hash,
calc_hash(hash, key, length ? length : hash->key_length),
key, length, current_record);
uchar *res;
if (my_hash_inited(hash))
res= my_hash_first_from_hash_value(hash,
calc_hash(hash, key, length ? length : hash->key_length),
key, length, current_record);
else
res= 0;
return res;
}
uchar* my_hash_first_from_hash_value(const HASH *hash,
my_hash_value_type hash_value,
const uchar *key,