1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

MDEV-35604: SIGSEGV in filter_query_type | log_statement_ex / auditing

Take into account that filter_query_type can get empty query after
skip_set_statement run on incorrect query.
This commit is contained in:
Oleksandr Byelkin
2024-12-09 08:54:17 +01:00
committed by Oleksandr Byelkin
parent 2ab10fbec2
commit 694d91da89
3 changed files with 27 additions and 0 deletions

View File

@@ -30,4 +30,13 @@ DROP USER u2;
set global server_audit_logging=off;
UNINSTALL PLUGIN ed25519;
UNINSTALL PLUGIN server_audit;
#
# MDEV-35604: SIGSEGV in filter_query_type | log_statement_ex / auditing
#
INSTALL PLUGIN server_audit SONAME 'server_audit';
SET GLOBAL server_audit_logging=ON;
SET STATEMENT max_error_count=1 SELECT 1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1' at line 1
SET GLOBAL server_audit_logging=OFF;
UNINSTALL SONAME 'server_audit';
# end of 10.5 tests

View File

@@ -56,4 +56,20 @@ UNINSTALL PLUGIN ed25519;
UNINSTALL PLUGIN server_audit;
--enable_warnings
--echo #
--echo # MDEV-35604: SIGSEGV in filter_query_type | log_statement_ex / auditing
--echo #
INSTALL PLUGIN server_audit SONAME 'server_audit';
SET GLOBAL server_audit_logging=ON;
--ERROR ER_PARSE_ERROR
SET STATEMENT max_error_count=1 SELECT 1;
# Cleanup
SET GLOBAL server_audit_logging=OFF;
--disable_warnings
UNINSTALL SONAME 'server_audit';
--enable_warnings
--echo # end of 10.5 tests

View File

@@ -1765,6 +1765,8 @@ static int filter_query_type(const char *query, struct sa_keyword *kwd)
char fword[MAX_KEYWORD + 1], nword[MAX_KEYWORD + 1];
int len, nlen= 0;
const struct sa_keyword *l_keywords;
if (!query)
return SQLCOM_NOTHING;
while (*query && (is_space(*query) || *query == '(' || *query == '/'))
{