-
Rohit Kalhans authored
BUG#12929941: SEGFAULT IN STRMAKE/CONVERT_DIRNAME WHEN USING --RELAY-LOG=SLAVE-RELAY-BIN Problem Description: The global variable 'char *mysql_real_data_home_ptr' is declared and initialized to the address of the global buffer char mysql_real_data_home[] in mysqld.cc. Then, the constructor for Sys_datadir overwrites mysql_real_data_home_ptr with NULL. In the case when value datadir is not given in both command-line as well as in cnf file and the default path (<basedir>/data) needs to be used, the mysql_real_data_home_ptr is not made to point to mysql_real_data_home and still has NULL value. After WL#5465, we use mysql_real_data_home_ptr when it still holds NULL as no cli or cnf file arguments were given. In particular, rpl_make_log_name passes mysql_real_data_home_ptr to fn_format. This caused a coredump because fn_format did not expect NULL. The following combinations caused the core dump 1.unspecified but existing empty default data dir and --log-bin 2.unspecified but existing empty default data dir and --relay-log=<some name for relay log> Solution: We solve this problem by making mysql_real_data_home_ptr to point to the mysql_real_data_home if it is null before passing it to fn_format function because by this time we know that mysql_real_data_home is correctly initialized and holds the final value of datadir path. We have also added asserts in fn_format() to check if the dir is null.
Rohit Kalhans authoredBUG#12929941: SEGFAULT IN STRMAKE/CONVERT_DIRNAME WHEN USING --RELAY-LOG=SLAVE-RELAY-BIN Problem Description: The global variable 'char *mysql_real_data_home_ptr' is declared and initialized to the address of the global buffer char mysql_real_data_home[] in mysqld.cc. Then, the constructor for Sys_datadir overwrites mysql_real_data_home_ptr with NULL. In the case when value datadir is not given in both command-line as well as in cnf file and the default path (<basedir>/data) needs to be used, the mysql_real_data_home_ptr is not made to point to mysql_real_data_home and still has NULL value. After WL#5465, we use mysql_real_data_home_ptr when it still holds NULL as no cli or cnf file arguments were given. In particular, rpl_make_log_name passes mysql_real_data_home_ptr to fn_format. This caused a coredump because fn_format did not expect NULL. The following combinations caused the core dump 1.unspecified but existing empty default data dir and --log-bin 2.unspecified but existing empty default data dir and --relay-log=<some name for relay log> Solution: We solve this problem by making mysql_real_data_home_ptr to point to the mysql_real_data_home if it is null before passing it to fn_format function because by this time we know that mysql_real_data_home is correctly initialized and holds the final value of datadir path. We have also added asserts in fn_format() to check if the dir is null.
Loading