1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

Fix for bug#15316 SET value having comma not correctly handled

disallow the use of comma in SET members


mysql-test/r/create.result:
  Fix for bug#15316 SET value having comma not correctly handled
   test case
mysql-test/t/create.test:
  Fix for bug#15316 SET value having comma not correctly handled
   test case
This commit is contained in:
unknown
2006-03-29 19:52:26 +05:00
parent a8c9bbd4be
commit 4af4e1e704
3 changed files with 25 additions and 0 deletions

View File

@@ -540,6 +540,11 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
sql_field->interval_list);
List_iterator<String> it(sql_field->interval_list);
String conv, *tmp;
char comma_buf[2];
int comma_length= cs->cset->wc_mb(cs, ',', (uchar*) comma_buf,
(uchar*) comma_buf +
sizeof(comma_buf));
DBUG_ASSERT(comma_length > 0);
for (uint i= 0; (tmp= it++); i++)
{
if (String::needs_conversion(tmp->length(), tmp->charset(),
@@ -559,6 +564,18 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
interval->type_lengths[i]);
interval->type_lengths[i]= lengthsp;
((uchar *)interval->type_names[i])[lengthsp]= '\0';
if (sql_field->sql_type == FIELD_TYPE_SET)
{
if (cs->coll->instr(cs, interval->type_names[i],
interval->type_lengths[i],
comma_buf, comma_length, NULL, 0))
{
my_printf_error(ER_UNKNOWN_ERROR,
"Illegal %s '%-.64s' value found during parsing",
MYF(0), "set", tmp->ptr());
DBUG_RETURN(-1);
}
}
}
sql_field->interval_list.empty(); // Don't need interval_list anymore
}