summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2020-08-28 19:52:49 +0400
committerOleksandr Byelkin <sanja@mariadb.com>2020-09-04 07:53:01 +0200
commit4e3dabc35b272e7f7bb068fa6326f5aa31a8bc6d (patch)
tree9d97c7ff073dede2f92118243bb5570d0fc36d19
parent6838651cfdb1b9ace094bb8c48d56892249af3a3 (diff)
downloadmariadb-git-4e3dabc35b272e7f7bb068fa6326f5aa31a8bc6d.tar.gz
MENT-361 ASAN heap-use-after-free in filter_query_type upon
concurrent flow with server auditing under PS protocol restore correct THD::query_string in Prepared_statement::reparepare().
-rw-r--r--sql/sql_prepare.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index cea8e7730c1..9e922c9c2f0 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -4572,6 +4572,15 @@ Prepared_statement::reprepare()
*/
thd->get_stmt_da()->clear_warning_info(thd->query_id);
}
+ else
+ {
+ /*
+ Prepare failed and the 'copy' will be freed.
+ Now we have to restore the query_string in the so the
+ audit plugin later gets the meaningful notification.
+ */
+ thd->set_query(query(), query_length());
+ }
return error;
}