Commit 8792d8a3 authored by Sergei Golubchik's avatar Sergei Golubchik

create table options bug:

parse_engine_table_options() was only called when there was at least option with a
non-default value. otherwise it was not called and option structure was not
allocated at all. NULL pointer dereference in ::open().
parent 2b8de050
...@@ -1633,10 +1633,11 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, ...@@ -1633,10 +1633,11 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
if (share->db_create_options & HA_OPTION_TEXT_CREATE_OPTIONS) if (share->db_create_options & HA_OPTION_TEXT_CREATE_OPTIONS)
{ {
DBUG_ASSERT(options_len); DBUG_ASSERT(options_len);
if (engine_table_options_frm_read(options, options_len, share) || if (engine_table_options_frm_read(options, options_len, share))
parse_engine_table_options(thd, handler_file->ht, share))
goto free_and_err; goto free_and_err;
} }
if (parse_engine_table_options(thd, handler_file->ht, share))
goto free_and_err;
my_free(buff, MYF(MY_ALLOW_ZERO_PTR)); my_free(buff, MYF(MY_ALLOW_ZERO_PTR));
if (share->found_next_number_field) if (share->found_next_number_field)
......
...@@ -367,6 +367,15 @@ int ha_example::open(const char *name, int mode, uint test_if_locked) ...@@ -367,6 +367,15 @@ int ha_example::open(const char *name, int mode, uint test_if_locked)
DBUG_RETURN(1); DBUG_RETURN(1);
thr_lock_data_init(&share->lock,&lock,NULL); thr_lock_data_init(&share->lock,&lock,NULL);
example_table_options_struct *options=
(example_table_options_struct *)table->s->option_struct;
DBUG_ASSERT(options);
DBUG_PRINT("info", ("strparam: '%-.64s' ullparam: %llu enumparam: %u "\
"boolparam: %u",
(options->strparam ? options->strparam : "<NULL>"),
options->ullparam, options->enumparam, options->boolparam));
DBUG_RETURN(0); DBUG_RETURN(0);
} }
......
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