#3937 libecl : Workaround to avoid crash for some summary files

This commit is contained in:
Magne Sjaastad
2019-01-30 15:42:20 +01:00
parent dfac372a9c
commit 24628e8ca4
2 changed files with 12 additions and 4 deletions

View File

@@ -844,11 +844,14 @@ static void ecl_smspec_install_special_keys( ecl_smspec_type * ecl_smspec , smsp
hash_insert_ref( ecl_smspec->field_var_index , keyword , smspec_node );
break;
case(ECL_SMSPEC_GROUP_VAR):
if (!hash_has_key(ecl_smspec->group_var_index , group))
hash_insert_hash_owned_ref(ecl_smspec->group_var_index , group, hash_alloc() , hash_free__);
if (group)
{
hash_type * var_hash = (hash_type*)hash_get(ecl_smspec->group_var_index , group);
hash_insert_ref(var_hash , keyword , smspec_node );
if (!hash_has_key(ecl_smspec->group_var_index , group))
hash_insert_hash_owned_ref(ecl_smspec->group_var_index , group, hash_alloc() , hash_free__);
{
hash_type * var_hash = (hash_type*)hash_get(ecl_smspec->group_var_index , group);
hash_insert_ref(var_hash , keyword , smspec_node );
}
}
break;
case(ECL_SMSPEC_REGION_VAR):

View File

@@ -82,6 +82,11 @@ static void * __hash_get_node(const hash_type *__hash , const char *key, bool ab
hash_type * hash = (hash_type *) __hash; /* The net effect is no change - but .... ?? */
hash_node_type * node = NULL;
{
if (key == NULL)
{
return NULL;
}
const uint32_t global_index = hash->hashf(key , strlen(key));
const uint32_t table_index = (global_index % hash->size);