summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandon Nesterenko <brandon.nesterenko@mariadb.com>2021-12-21 16:22:33 -0700
committerBrandon Nesterenko <brandon.nesterenko@mariadb.com>2021-12-22 15:02:06 -0700
commitbe20b3b03f9c522d17b3454214981506549063eb (patch)
treecce9c8b131efb1a57a5cdd2be594d8a28bee73dd
parent6487b8e33060b54612981e81b663aff15724fbdf (diff)
downloadmariadb-git-bb-10.5-MDEV-26919.tar.gz
MDEV-26919: binlog.binlog_truncate_active_log fails in bb with valgrind, Conditional jump or move depends on uninitialised valuebb-10.5-MDEV-26919
Problem: ======== When writing an XA based event to the binary log, an assert was always referencing thd->lex->xa_opt. This variable, however, is only set when using XA START, XA END, and XA COMMIT. When an XA PREPARE statement is being processed, it is not guaranteed that the xa_opt variable will be set (e.g. if existing within a stored procedure). This caused valgrind to complain about accessing an uninitialized variable. Solution: ======== Before referencing xa_opt, ensure the context is valid such that it is set. Reviewed By: ============ Andrei Elkin <andrei.elkin@mariadb.com>
-rw-r--r--sql/log_event_server.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/log_event_server.cc b/sql/log_event_server.cc
index 093adebf536..7c4ea488f9e 100644
--- a/sql/log_event_server.cc
+++ b/sql/log_event_server.cc
@@ -3281,7 +3281,8 @@ Gtid_log_event::Gtid_log_event(THD *thd_arg, uint64 seq_no_arg,
(thd->lex->sql_command == SQLCOM_XA_PREPARE ||
xid_state.get_state_code() == XA_PREPARED))
{
- DBUG_ASSERT(thd->lex->xa_opt != XA_ONE_PHASE);
+ DBUG_ASSERT(!(thd->lex->sql_command == SQLCOM_XA_COMMIT &&
+ thd->lex->xa_opt == XA_ONE_PHASE));
flags2|= thd->lex->sql_command == SQLCOM_XA_PREPARE ?
FL_PREPARED_XA : FL_COMPLETED_XA;