Description:
mysql_client_binlog_statement() is called when BINLOG ... statement is executed in server. When investigating BUG#20929, I created BINLOG statements for the commands
RESET MASTER;
CREATE DATABASE mydb;
USE mydb;
CREATE TABLE t (a DATETIME);
INSERT INTO t VALUES(NOW()); # will later cause assert
DROP DATABASE mydb; # will later cause invalid free
listed there (using mysqlbinlog --base64-output). When executing these statements I get the following complaint from valgrind:
==12533== Invalid read of size 1
==12533== at 0x855BA6C: base64_decode (base64.c:106)
==12533== by 0x83CD521: mysql_client_binlog_statement(THD*) (sql_binlog.cc:80)
==12533== by 0x823DD35: mysql_execute_command(THD*) (sql_parse.cc:5187)
==12533== by 0x823FAAE: mysql_parse(THD*, char*, unsigned) (sql_parse.cc:6105)
==12533== by 0x8235399: dispatch_command(enum_server_command, THD*, char*, unsigned) (sql_parse.cc:1858)
==12533== by 0x8234BA8: do_command(THD*) (sql_parse.cc:1627)
==12533== by 0x8233CC4: handle_one_connection (sql_parse.cc:1233)
==12533== by 0x4043E50: pthread_start_thread (in /lib/libpthread-0.10.so)
==12533== by 0x41CA8A9: clone (in /lib/libc-2.3.2.so)
==12533== Address 0x54FCA5B is 131 bytes inside a block of size 362 free'd
==12533== at 0x401C39E: free (vg_replace_malloc.c:233)
==12533== by 0x854A49C: my_no_flags_free (my_malloc.c:60)
==12533== by 0x854AEBC: free_root (my_alloc.c:348)
==12533== by 0x82BFFF5: Query_log_event::exec_event(st_relay_log_info*, char const*, unsigned) (log_event.cc:2138)
==12533== by 0x82BF5C9: Query_log_event::exec_event(st_relay_log_info*) (log_event.cc:1873)
==12533== by 0x83CD6B1: mysql_client_binlog_statement(THD*) (sql_binlog.cc:167)
==12533== by 0x823DD35: mysql_execute_command(THD*) (sql_parse.cc:5187)
==12533== by 0x823FAAE: mysql_parse(THD*, char*, unsigned) (sql_parse.cc:6105)
==12533== by 0x8235399: dispatch_command(enum_server_command, THD*, char*, unsigned) (sql_parse.cc:1858)
==12533== by 0x8234BA8: do_command(THD*) (sql_parse.cc:1627)
==12533== by 0x8233CC4: handle_one_connection (sql_parse.cc:1233)
==12533== by 0x4043E50: pthread_start_thread (in /lib/libpthread-0.10.so)
==12533== by 0x41CA8A9: clone (in /lib/libc-2.3.2.so)
How to repeat:
Start mysqld inside valgrind, connect to it and execute BINLOG commands from the attached binlog.sql file.