Bug#32158 Crash in open_table_from_share, on mysql_unpack_partition errors

added check for the result of mysql_unpack_partition()
parent 7a471998
...@@ -1787,13 +1787,18 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias, ...@@ -1787,13 +1787,18 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
outparam, is_create_table, outparam, is_create_table,
share->default_part_db_type, share->default_part_db_type,
&work_part_info_used); &work_part_info_used);
if (!tmp) if (tmp)
{
thd->stmt_arena= backup_stmt_arena_ptr;
thd->restore_active_arena(&part_func_arena, &backup_arena);
goto partititon_err;
}
outparam->part_info->is_auto_partitioned= share->auto_partitioned; outparam->part_info->is_auto_partitioned= share->auto_partitioned;
DBUG_PRINT("info", ("autopartitioned: %u", share->auto_partitioned)); DBUG_PRINT("info", ("autopartitioned: %u", share->auto_partitioned));
/* we should perform the fix_partition_func in either local or /* we should perform the fix_partition_func in either local or
caller's arena depending on work_part_info_used value caller's arena depending on work_part_info_used value
*/ */
if (!tmp && !work_part_info_used) if (!work_part_info_used)
tmp= fix_partition_func(thd, outparam, is_create_table); tmp= fix_partition_func(thd, outparam, is_create_table);
thd->stmt_arena= backup_stmt_arena_ptr; thd->stmt_arena= backup_stmt_arena_ptr;
thd->restore_active_arena(&part_func_arena, &backup_arena); thd->restore_active_arena(&part_func_arena, &backup_arena);
...@@ -1803,6 +1808,7 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias, ...@@ -1803,6 +1808,7 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
tmp= fix_partition_func(thd, outparam, is_create_table); tmp= fix_partition_func(thd, outparam, is_create_table);
outparam->part_info->item_free_list= part_func_arena.free_list; outparam->part_info->item_free_list= part_func_arena.free_list;
} }
partititon_err:
if (tmp) if (tmp)
{ {
if (is_create_table) if (is_create_table)
......
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