diff options
Diffstat (limited to 'sql/log_event.cc')
-rw-r--r-- | sql/log_event.cc | 45 |
1 files changed, 14 insertions, 31 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc index 76170778bad..98b34543cb3 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -16,12 +16,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include <my_global.h> #include "sql_priv.h" #include "mysqld_error.h" #ifndef MYSQL_CLIENT -#include "my_global.h" // REQUIRED by log_event.h > m_string.h > my_bitmap.h -#include "sql_priv.h" #include "unireg.h" #include "log_event.h" #include "sql_base.h" // close_thread_tables @@ -89,23 +88,6 @@ TYPELIB binlog_checksum_typelib= */ #define FMT_G_BUFSIZE(PREC) (3 + (PREC) + 5 + 1) -/* - Explicit instantiation to unsigned int of template available_buffer - function. -*/ -template unsigned int available_buffer<unsigned int>(const char*, - const char*, - unsigned int); - -/* - Explicit instantiation to unsigned int of template valid_buffer_range - function. -*/ -template bool valid_buffer_range<unsigned int>(unsigned int, - const char*, - const char*, - unsigned int); - /* replication event checksum is introduced in the following "checksum-home" version. The checksum-aware servers extract FD's version to decide whether the FD event @@ -3214,7 +3196,10 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg, thd->in_multi_stmt_transaction_mode()) || trx_cache; break; case SQLCOM_SET_OPTION: - use_cache= trx_cache= (lex->autocommit ? FALSE : TRUE); + if (lex->autocommit) + use_cache= trx_cache= FALSE; + else + use_cache= TRUE; break; case SQLCOM_RELEASE_SAVEPOINT: case SQLCOM_ROLLBACK_TO_SAVEPOINT: @@ -7524,9 +7509,9 @@ User_var_log_event(const char* buf, uint event_len, #endif { bool error= false; - const char* buf_start= buf; + const char* buf_start= buf, *buf_end= buf + event_len; + /* The Post-Header is empty. The Variable Data part begins immediately. */ - const char *start= buf; buf+= description_event->common_header_len + description_event->post_header_len[USER_VAR_EVENT-1]; name_len= uint4korr(buf); @@ -7537,8 +7522,7 @@ User_var_log_event(const char* buf, uint event_len, may have the bigger value possible, is_null= True and there is no payload for val, or even that name_len is 0. */ - if (!valid_buffer_range<uint>(name_len, buf_start, name, - event_len - UV_VAL_IS_NULL)) + if (name + name_len + UV_VAL_IS_NULL > buf_end) { error= true; goto err; @@ -7556,9 +7540,10 @@ User_var_log_event(const char* buf, uint event_len, } else { - if (!valid_buffer_range<uint>(UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE - + UV_CHARSET_NUMBER_SIZE + UV_VAL_LEN_SIZE, - buf_start, buf, event_len)) + val= (char *) (buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE + + UV_CHARSET_NUMBER_SIZE + UV_VAL_LEN_SIZE); + + if (val > buf_end) { error= true; goto err; @@ -7568,10 +7553,8 @@ User_var_log_event(const char* buf, uint event_len, charset_number= uint4korr(buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE); val_len= uint4korr(buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE + UV_CHARSET_NUMBER_SIZE); - val= (char *) (buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE + - UV_CHARSET_NUMBER_SIZE + UV_VAL_LEN_SIZE); - if (!valid_buffer_range<uint>(val_len, buf_start, val, event_len)) + if (val + val_len > buf_end) { error= true; goto err; @@ -7588,7 +7571,7 @@ User_var_log_event(const char* buf, uint event_len, Old events will not have this extra byte, thence, we keep the flags set to UNDEF_F. */ - uint bytes_read= ((val + val_len) - start); + uint bytes_read= ((val + val_len) - buf_start); #ifndef DBUG_OFF bool old_pre_checksum_fd= description_event->is_version_before_checksum( &description_event->server_version_split); |