diff options
author | Sergei Golubchik <sergii@pisem.net> | 2014-02-17 11:00:51 +0100 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2014-02-17 11:00:51 +0100 |
commit | 84651126c0f101ea762eec0eb4045f533a00e96d (patch) | |
tree | 1bba1d0079b08cb10fe69e03942cd5f254dc735e /sql/log_event.cc | |
parent | 1fa5183241e5a8e8e91690f0c35d676e9f3334ca (diff) | |
parent | f7c8dd6bc7bb6d46d1ae2b6fdb47227429387e33 (diff) | |
download | mariadb-git-84651126c0f101ea762eec0eb4045f533a00e96d.tar.gz |
MySQL-5.5.36 merge
(without few incorrect bugfixes and with 1250 files where only a copyright year was changed)
Diffstat (limited to 'sql/log_event.cc')
-rw-r--r-- | sql/log_event.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc index 73686a2fd0c..826a45f6da8 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -19,6 +19,7 @@ #ifdef MYSQL_CLIENT #include "sql_priv.h" +#include "mysqld_error.h" #else @@ -2250,6 +2251,14 @@ Rows_log_event::print_verbose_one_row(IO_CACHE *file, table_def *td, else { my_b_printf(file, "### @%d=", i + 1); + size_t fsize= td->calc_field_size((uint)i, (uchar*) value); + if (value + fsize > m_rows_end) + { + my_b_printf(file, "***Corrupted replication event was detected." + " Not printing the value***\n"); + value+= fsize; + return 0; + } size_t size= log_event_print_value(file, value, td->type(i), td->field_metadata(i), typestr, sizeof(typestr)); @@ -5162,11 +5171,22 @@ int Load_log_event::copy_log_event(const char *buf, ulong event_len, fields = (char*)field_lens + num_fields; table_name = fields + field_block_len; db = table_name + table_name_len + 1; + DBUG_EXECUTE_IF ("simulate_invalid_address", + db_len = data_len;); fname = db + db_len + 1; + if ((db_len > data_len) || (fname > buf_end)) + goto err; fname_len = (uint) strlen(fname); + if ((fname_len > data_len) || (fname + fname_len > buf_end)) + goto err; // null termination is accomplished by the caller doing buf[event_len]=0 DBUG_RETURN(0); + +err: + // Invalid event. + table_name = 0; + DBUG_RETURN(1); } |