diff --git a/mysql-test/main/func_str.result b/mysql-test/main/func_str.result index a9077eb2e00..ee86445d9ab 100644 --- a/mysql-test/main/func_str.result +++ b/mysql-test/main/func_str.result @@ -1,4 +1,3 @@ -drop table if exists t1,t2; set @save_max_allowed_packet=@@global.max_allowed_packet; set global max_allowed_packet=1048576; connect conn1,localhost,root,,; @@ -5405,7 +5404,7 @@ Warnings: Warning 1292 Truncated incorrect INTEGER value: 'test' Warning 1292 Truncated incorrect INTEGER value: 'test' # -# MDEV-29108: RANDOM_BYTES - assertion in Create_tmp_table::finalize +# MDEV-29108 RANDOM_BYTES - assertion in Create_tmp_table::finalize # CREATE TABLE t (a INT); INSERT INTO t VALUES (1),(2); @@ -5415,7 +5414,7 @@ NULL 1 NULL 2 DROP TABLE t; # -# MDEV-29154: Excessive warnings upon a call to RANDOM_BYTES +# MDEV-29154 Excessive warnings upon a call to RANDOM_BYTES # select length(random_bytes(cast('x' as unsigned)+1)); length(random_bytes(cast('x' as unsigned)+1)) @@ -5430,5 +5429,13 @@ Warnings: Warning 1292 Truncated incorrect INTEGER value: 'x' Warning 1292 Truncated incorrect INTEGER value: 'x' # +# MDEV-23149 Server crashes in my_convert / ErrConvString::ptr / Item_char_typecast::check_truncation_with_warn +# +select "a" in ("abc", (convert(random_bytes(8) ,binary(2)))); +"a" in ("abc", (convert(random_bytes(8) ,binary(2)))) +0 +Warnings: +Warning 1292 Truncated incorrect BINARY(2) value: '...random bytes...' +# # End of 10.10 tests # diff --git a/mysql-test/main/func_str.test b/mysql-test/main/func_str.test index 1d051045637..e8d21ffc015 100644 --- a/mysql-test/main/func_str.test +++ b/mysql-test/main/func_str.test @@ -3,10 +3,6 @@ # Testing string functions --source include/have_sequence.inc ---disable_warnings -drop table if exists t1,t2; ---enable_warnings - set @save_max_allowed_packet=@@global.max_allowed_packet; set global max_allowed_packet=1048576; connect (conn1,localhost,root,,); @@ -2261,7 +2257,7 @@ SELECT random_bytes('res'); SELECT random_bytes('test'); --echo # ---echo # MDEV-29108: RANDOM_BYTES - assertion in Create_tmp_table::finalize +--echo # MDEV-29108 RANDOM_BYTES - assertion in Create_tmp_table::finalize --echo # CREATE TABLE t (a INT); @@ -2272,12 +2268,18 @@ SELECT RANDOM_BYTES(-10) f1, IFNULL(a,1) f2 FROM t GROUP BY f1, f2; DROP TABLE t; --echo # ---echo # MDEV-29154: Excessive warnings upon a call to RANDOM_BYTES +--echo # MDEV-29154 Excessive warnings upon a call to RANDOM_BYTES --echo # select length(random_bytes(cast('x' as unsigned)+1)); select repeat('.', cast('x' as unsigned)+1); +--echo # +--echo # MDEV-23149 Server crashes in my_convert / ErrConvString::ptr / Item_char_typecast::check_truncation_with_warn +--echo # +--replace_regex /'.*'/'...random bytes...'/ +select "a" in ("abc", (convert(random_bytes(8) ,binary(2)))); + --echo # --echo # End of 10.10 tests --echo # diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 4c3b3474a4d..873ead13e41 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1517,6 +1517,7 @@ String *Item_func_random_bytes::val_str(String *str) goto err; str->length(count); + str->set_charset(&my_charset_bin); if (my_random_bytes((unsigned char *) str->ptr(), (int32) count)) { ulong ssl_err;