summaryrefslogtreecommitdiff
path: root/sql/sql_repl.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-12-03 20:26:42 +0100
committerSergei Golubchik <serg@mariadb.org>2016-12-06 09:45:50 +0100
commit952856c810c7a44678960a455062531279ddf113 (patch)
tree5708578a90fe764168fb8af709cd30339928d9f3 /sql/sql_repl.cc
parent611f91605adce17df87acf96b5aede0b73d0fc12 (diff)
downloadmariadb-git-952856c810c7a44678960a455062531279ddf113.tar.gz
MDEV-11288 Server crashes in Binlog_crypt_data::init trying to feed encrypted log without decryption capabilities
Diffstat (limited to 'sql/sql_repl.cc')
-rw-r--r--sql/sql_repl.cc24
1 files changed, 13 insertions, 11 deletions
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 572d08399d5..0dd4c59ce56 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -2212,6 +2212,7 @@ static int send_format_descriptor_event(binlog_send_info *info, IO_CACHE *log,
THD *thd= info->thd;
String *packet= info->packet;
Log_event_type event_type;
+ DBUG_ENTER("send_format_descriptor_event");
/**
* 1) reset fdev before each log-file
@@ -2226,12 +2227,12 @@ static int send_format_descriptor_event(binlog_send_info *info, IO_CACHE *log,
{
info->errmsg= "Out of memory initializing format_description event";
info->error= ER_MASTER_FATAL_ERROR_READING_BINLOG;
- return 1;
+ DBUG_RETURN(1);
}
/* reset transmit packet for the event read from binary log file */
if (reset_transmit_packet(info, info->flags, &ev_offset, &info->errmsg))
- return 1;
+ DBUG_RETURN(1);
/*
Try to find a Format_description_log_event at the beginning of
@@ -2247,7 +2248,7 @@ static int send_format_descriptor_event(binlog_send_info *info, IO_CACHE *log,
if (error)
{
set_read_error(info, error);
- return 1;
+ DBUG_RETURN(1);
}
event_type= (Log_event_type)((uchar)(*packet)[LOG_EVENT_OFFSET+ev_offset]);
@@ -2268,7 +2269,7 @@ static int send_format_descriptor_event(binlog_send_info *info, IO_CACHE *log,
sql_print_warning("Failed to find format descriptor event in "
"start of binlog: %s",
info->log_file_name);
- return 1;
+ DBUG_RETURN(1);
}
info->current_checksum_alg= get_checksum_alg(packet->ptr() + ev_offset,
@@ -2288,7 +2289,7 @@ static int send_format_descriptor_event(binlog_send_info *info, IO_CACHE *log,
sql_print_warning("Master is configured to log replication events "
"with checksum, but will not send such events to "
"slaves that cannot process them");
- return 1;
+ DBUG_RETURN(1);
}
uint ev_len= packet->length() - ev_offset;
@@ -2302,7 +2303,7 @@ static int send_format_descriptor_event(binlog_send_info *info, IO_CACHE *log,
info->error= ER_MASTER_FATAL_ERROR_READING_BINLOG;
info->errmsg= "Corrupt Format_description event found "
"or out-of-memory";
- return 1;
+ DBUG_RETURN(1);
}
delete info->fdev;
info->fdev= tmp;
@@ -2361,7 +2362,7 @@ static int send_format_descriptor_event(binlog_send_info *info, IO_CACHE *log,
{
info->errmsg= "Failed on my_net_write()";
info->error= ER_UNKNOWN_ERROR;
- return 1;
+ DBUG_RETURN(1);
}
/*
@@ -2381,7 +2382,7 @@ static int send_format_descriptor_event(binlog_send_info *info, IO_CACHE *log,
if (error)
{
set_read_error(info, error);
- return 1;
+ DBUG_RETURN(1);
}
event_type= (Log_event_type)((uchar)(*packet)[LOG_EVENT_OFFSET]);
@@ -2393,14 +2394,15 @@ static int send_format_descriptor_event(binlog_send_info *info, IO_CACHE *log,
if (!sele)
{
info->error= ER_MASTER_FATAL_ERROR_READING_BINLOG;
- return 1;
+ DBUG_RETURN(1);
}
if (info->fdev->start_decryption(sele))
{
info->error= ER_MASTER_FATAL_ERROR_READING_BINLOG;
info->errmsg= "Could not decrypt binlog: encryption key error";
- return 1;
+ delete sele;
+ DBUG_RETURN(1);
}
delete sele;
}
@@ -2416,7 +2418,7 @@ static int send_format_descriptor_event(binlog_send_info *info, IO_CACHE *log,
/** all done */
- return 0;
+ DBUG_RETURN(0);
}
static bool should_stop(binlog_send_info *info)