summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2021-11-02 16:02:56 +0400
committerAlexander Barkov <bar@mariadb.com>2022-01-27 09:44:11 +0400
commit3d69213e74f66fb3e5253d68853d7132bc76cf55 (patch)
tree2aac72344d2654bae75d2f015d1ef305f231d945 /mysql-test
parent4775677457b501b40714c74e5867ac83cfa4906d (diff)
downloadmariadb-git-3d69213e74f66fb3e5253d68853d7132bc76cf55.tar.gz
MDEV-26953 Assertion `!str || str != Ptr || !is_alloced()' failed in String::copy upon SELECT with sjis
Item::save_str_in_field() passes &Item::str_value as a parameter to val_str(). Item_func::make_empty_result() also fills and returns str_value. As a result, in the reported scenario in Item_func::val_str_from_val_str_ascii() both "str" and "res" pointed to Item::str_value, which made the DBUG_ASSERT inside String::copy() (preventing copying to itself) crash: if ((null_value= str->copy(res->ptr(), res->length(), &my_charset_latin1, collation.collation, &errors))) Fix: - Adding a String* parameter to make_empty_result() - Passing the val_str() parameter to make_empty_string().
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/main/ctype_sjis.result16
-rw-r--r--mysql-test/main/ctype_sjis.test19
2 files changed, 35 insertions, 0 deletions
diff --git a/mysql-test/main/ctype_sjis.result b/mysql-test/main/ctype_sjis.result
index fdb24fdc0e5..42f4f5141a8 100644
--- a/mysql-test/main/ctype_sjis.result
+++ b/mysql-test/main/ctype_sjis.result
@@ -19296,3 +19296,19 @@ SET STORAGE_ENGINE=Default;
#
# End of 10.2 tests
#
+#
+# Start of 10.4 tests
+#
+#
+# MDEV-26953 Assertion `!str || str != Ptr || !is_alloced()' failed in String::copy upon SELECT with sjis
+#
+SET NAMES sjis;
+CREATE TABLE t (a VARCHAR(3));
+INSERT INTO t VALUES (''),('');
+SELECT GROUP_CONCAT(PASSWORD(a)) AS f FROM t;
+f
+,
+DROP TABLE t;
+#
+# End of 10.4 tests
+#
diff --git a/mysql-test/main/ctype_sjis.test b/mysql-test/main/ctype_sjis.test
index 9a8ce414c14..00662fdf2a0 100644
--- a/mysql-test/main/ctype_sjis.test
+++ b/mysql-test/main/ctype_sjis.test
@@ -260,3 +260,22 @@ let $coll_pad='sjis_bin';
--echo #
--echo # End of 10.2 tests
--echo #
+
+
+--echo #
+--echo # Start of 10.4 tests
+--echo #
+
+--echo #
+--echo # MDEV-26953 Assertion `!str || str != Ptr || !is_alloced()' failed in String::copy upon SELECT with sjis
+--echo #
+
+SET NAMES sjis;
+CREATE TABLE t (a VARCHAR(3));
+INSERT INTO t VALUES (''),('');
+SELECT GROUP_CONCAT(PASSWORD(a)) AS f FROM t;
+DROP TABLE t;
+
+--echo #
+--echo # End of 10.4 tests
+--echo #