[INTERPRETER]

* BUG: Fix a possible crash in Val().
* BUG: Fix a possible crash when reading a non-existing key in a 
  Collection.


git-svn-id: svn://localhost/gambas/trunk@3234 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2010-09-23 01:34:15 +00:00
parent 1417bcfe3e
commit 7b99389464
2 changed files with 10 additions and 12 deletions

View file

@ -361,16 +361,16 @@ int GB_CollectionGet(GB_COLLECTION col, const char *key, int len, GB_VARIANT *va
VARIANT *var;
var = (VARIANT *)collection_get_key((CCOLLECTION *)col, key, len);
value->type = T_VARIANT;
if (var)
{
value->type = T_VARIANT;
value->value.type = var->type;
value->value.value.data = var->value.data;
return FALSE;
}
else
{
value->type = GB_T_NULL;
value->value.type = GB_T_NULL;
return TRUE;
}
}

View file

@ -157,19 +157,17 @@ void SUBR_val(void)
{
char *addr;
int len;
VALUE result;
SUBR_ENTER_PARAM(1);
SUBR_check_string(PARAM);
VALUE_get_string(PARAM, &addr, &len);
VALUE_from_string(&result, addr, len);
VALUE_conv_variant(&result);
*RETURN = result;
if (SUBR_check_string(PARAM))
RETURN->type = T_NULL;
else
{
VALUE_get_string(PARAM, &addr, &len);
VALUE_from_string(RETURN, addr, len);
VALUE_conv_variant(RETURN);
}
SUBR_LEAVE();
}