1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-11288 Server crashes in Binlog_crypt_data::init trying to feed encrypted log without decryption capabilities

This commit is contained in:
Sergei Golubchik
2016-12-03 20:26:42 +01:00
parent 611f91605a
commit 952856c810
5 changed files with 115 additions and 20 deletions

View File

@ -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)