Commit c08f20d5 authored by Mattias Jonsson's avatar Mattias Jonsson

Bug#16860588:CRASH WITH CREATE TABLE ... LIKE ..

AND PARTITION VALUES IN (NULL)

The code assumed there was at least one list element
in LIST partitioned table.

Fixed by checking the number of list elements.
parent 8808c6b3
...@@ -2214,11 +2214,10 @@ int partition_info::fix_parser_data(THD *thd) ...@@ -2214,11 +2214,10 @@ int partition_info::fix_parser_data(THD *thd)
{ {
part_elem= it++; part_elem= it++;
List_iterator<part_elem_value> list_val_it(part_elem->list_val_list); List_iterator<part_elem_value> list_val_it(part_elem->list_val_list);
j= 0;
num_elements= part_elem->list_val_list.elements; num_elements= part_elem->list_val_list.elements;
DBUG_ASSERT(part_type == RANGE_PARTITION ? DBUG_ASSERT(part_type == RANGE_PARTITION ?
num_elements == 1U : TRUE); num_elements == 1U : TRUE);
do for (j= 0; j < num_elements; j++)
{ {
part_elem_value *val= list_val_it++; part_elem_value *val= list_val_it++;
if (column_list) if (column_list)
...@@ -2253,7 +2252,7 @@ int partition_info::fix_parser_data(THD *thd) ...@@ -2253,7 +2252,7 @@ int partition_info::fix_parser_data(THD *thd)
list_val_it.remove(); list_val_it.remove();
} }
} }
} while (++j < num_elements); }
} while (++i < num_parts); } while (++i < num_parts);
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment