[Maria-developers] Rev 2786: create table options bug: in http://bazaar.launchpad.net/~maria-captains/maria/5.2/
At http://bazaar.launchpad.net/~maria-captains/maria/5.2/ ------------------------------------------------------------ revno: 2786 revision-id: sergii@pisem.net-20100430200927-ns4ykuzr2l760bdc parent: sergii@pisem.net-20100430200435-1wr1ghgs9ahga0wg committer: Sergei Golubchik <sergii@pisem.net> branch nick: 5.2 timestamp: Fri 2010-04-30 22:09:27 +0200 message: 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(). === modified file 'sql/table.cc' --- a/sql/table.cc 2010-04-08 12:10:05 +0000 +++ b/sql/table.cc 2010-04-30 20:09:27 +0000 @@ -1633,10 +1633,11 @@ static int open_binary_frm(THD *thd, TAB if (share->db_create_options & HA_OPTION_TEXT_CREATE_OPTIONS) { DBUG_ASSERT(options_len); - if (engine_table_options_frm_read(options, options_len, share) || - parse_engine_table_options(thd, handler_file->ht, share)) + if (engine_table_options_frm_read(options, options_len, share)) 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)); if (share->found_next_number_field) === modified file 'storage/example/ha_example.cc' --- a/storage/example/ha_example.cc 2010-04-30 10:12:25 +0000 +++ b/storage/example/ha_example.cc 2010-04-30 20:09:27 +0000 @@ -367,6 +367,15 @@ int ha_example::open(const char *name, i DBUG_RETURN(1); 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); }
participants (1)
-
serg@askmonty.org