From 8ef41c60847be839914b04951852df82c61ae6a2 Mon Sep 17 00:00:00 2001 From: Teemu Ollakka Date: Thu, 23 Jul 2020 14:48:07 +0300 Subject: [PATCH] MDEV-23272 Galera stack-use-after-scope error with ASAN build THD proc info was assigned from stack allocated temporary buffer which went out of scope immediately after assignment. Fixed by removing the use of temp buffer and assign proc info from string literal. --- storage/innobase/handler/ha_innodb.cc | 9 --------- storage/xtradb/handler/ha_innodb.cc | 9 --------- 2 files changed, 18 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 9ca8fe86ec6..10098a2fa4d 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -4188,16 +4188,7 @@ innobase_commit_low( #ifdef WITH_WSREP const char* tmp = 0; if (trx->is_wsrep()) { -#ifdef WSREP_PROC_INFO - char info[64]; - info[sizeof(info) - 1] = '\0'; - snprintf(info, sizeof(info) - 1, - "innobase_commit_low():trx_commit_for_mysql(%lld)", - (long long) wsrep_thd_trx_seqno(trx->mysql_thd)); - tmp = thd_proc_info(trx->mysql_thd, info); -#else tmp = thd_proc_info(trx->mysql_thd, "innobase_commit_low()"); -#endif /* WSREP_PROC_INFO */ } #endif /* WITH_WSREP */ if (trx_is_started(trx)) { diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index 1cbe334ef09..bb324faf2b6 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -4678,16 +4678,7 @@ innobase_commit_low( #ifdef WITH_WSREP const char* tmp = 0; if (trx->is_wsrep()) { -#ifdef WSREP_PROC_INFO - char info[64]; - info[sizeof(info) - 1] = '\0'; - snprintf(info, sizeof(info) - 1, - "innobase_commit_low():trx_commit_for_mysql(%lld)", - (long long) wsrep_thd_trx_seqno(trx->mysql_thd)); - tmp = thd_proc_info(trx->mysql_thd, info); -#else tmp = thd_proc_info(trx->mysql_thd, "innobase_commit_low()"); -#endif /* WSREP_PROC_INFO */ } #endif /* WITH_WSREP */ if (trx_is_started(trx)) {