summaryrefslogtreecommitdiff
path: root/sql/vers_string.h
diff options
context:
space:
mode:
authortmokmss <tomookam@live.jp>2022-06-05 08:04:18 +0000
committerNikita Malyavin <nikitamalyavin@gmail.com>2022-08-26 12:40:58 +0300
commit827b049e1e7df204feb744a270b4dca619a61de1 (patch)
tree607c8f72697c91d696c7a931af1698d545e57f00 /sql/vers_string.h
parent851058a3e6f40cd2714762916235ebe93fc594b5 (diff)
downloadmariadb-git-827b049e1e7df204feb744a270b4dca619a61de1.tar.gz
MDEV-18873 Server crashes in Compare_identifiers::operator or in my_strcasecmp_utf8 upon ADD PERIOD IF NOT EXISTS with empty name
empty identifier specified as `` ends up with a NULL LEX_CSTRING::str in lexer. This is not considered correct in upper layers, for example in Compare_identifiers::operator(). Empty column name is usually avoided by a check_column_name() call while parsing, and period name matches the column name completely. Hence, this fix uses the mentioned call for verification, too.
Diffstat (limited to 'sql/vers_string.h')
-rw-r--r--sql/vers_string.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/sql/vers_string.h b/sql/vers_string.h
index 2349cc0cac1..cfadc890dcd 100644
--- a/sql/vers_string.h
+++ b/sql/vers_string.h
@@ -39,6 +39,8 @@ struct Compare_identifiers
{
int operator()(const LEX_CSTRING& a, const LEX_CSTRING& b) const
{
+ DBUG_ASSERT(a.str != NULL);
+ DBUG_ASSERT(b.str != NULL);
DBUG_ASSERT(a.str[a.length] == 0);
DBUG_ASSERT(b.str[b.length] == 0);
return my_strcasecmp(system_charset_info, a.str, b.str);