diff options
author | Sergei Golubchik <serg@mariadb.org> | 2022-08-09 14:24:53 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2022-08-10 08:54:22 +0200 |
commit | 82c07fcabf039b2dc8f4b148e46bdb9662f3c0b1 (patch) | |
tree | 1b0e3c57c528200b4f39a911741abe11c119457e | |
parent | 47d0df6ef02fa1acd5581d1322475a08be3066f5 (diff) | |
download | mariadb-git-82c07fcabf039b2dc8f4b148e46bdb9662f3c0b1.tar.gz |
MDEV-23149 Server crashes in my_convert / ErrConvString::ptr / Item_char_typecast::check_truncation_with_warn
-rw-r--r-- | mysql-test/main/func_compress.result | 11 | ||||
-rw-r--r-- | mysql-test/main/func_compress.test | 9 | ||||
-rw-r--r-- | mysql-test/main/func_json.result | 4 | ||||
-rw-r--r-- | mysql-test/main/func_json.test | 2 | ||||
-rw-r--r-- | sql/item_strfunc.cc | 1 |
5 files changed, 17 insertions, 10 deletions
diff --git a/mysql-test/main/func_compress.result b/mysql-test/main/func_compress.result index 065b68b4979..dde7080fb2a 100644 --- a/mysql-test/main/func_compress.result +++ b/mysql-test/main/func_compress.result @@ -193,9 +193,6 @@ DROP TABLE t1; # End of 10.1 tests # # -# Start of 10.2 tests -# -# # MDEV-10134 Add full support for DEFAULT # CREATE TABLE t1 (a TEXT, b BLOB DEFAULT COMPRESS(a), bl INT DEFAULT UNCOMPRESSED_LENGTH(b), a1 TEXT DEFAULT UNCOMPRESS(b)); @@ -213,5 +210,13 @@ bl a1 100 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa DROP TABLE t1; # +# MDEV-23149 Server crashes in my_convert / ErrConvString::ptr / Item_char_typecast::check_truncation_with_warn +# +select 'foo' in (cast(compress('bar') as char(4)), 'qux'); +'foo' in (cast(compress('bar') as char(4)), 'qux') +0 +Warnings: +Warning 1292 Truncated incorrect CHAR(4) value: '\x03\x00\x00\x00x\x9CKJ,\x02\x00\x02]\x016' +# # End of 10.2 tests # diff --git a/mysql-test/main/func_compress.test b/mysql-test/main/func_compress.test index 983b792f4c4..2a6c0276705 100644 --- a/mysql-test/main/func_compress.test +++ b/mysql-test/main/func_compress.test @@ -174,10 +174,6 @@ DROP TABLE t1; --echo # --echo # ---echo # Start of 10.2 tests ---echo # - ---echo # --echo # MDEV-10134 Add full support for DEFAULT --echo # CREATE TABLE t1 (a TEXT, b BLOB DEFAULT COMPRESS(a), bl INT DEFAULT UNCOMPRESSED_LENGTH(b), a1 TEXT DEFAULT UNCOMPRESS(b)); @@ -187,5 +183,10 @@ SELECT bl, a1 FROM t1; DROP TABLE t1; --echo # +--echo # MDEV-23149 Server crashes in my_convert / ErrConvString::ptr / Item_char_typecast::check_truncation_with_warn +--echo # +select 'foo' in (cast(compress('bar') as char(4)), 'qux'); + +--echo # --echo # End of 10.2 tests --echo # diff --git a/mysql-test/main/func_json.result b/mysql-test/main/func_json.result index 8e3b47e322a..48ce7ed1b3f 100644 --- a/mysql-test/main/func_json.result +++ b/mysql-test/main/func_json.result @@ -765,8 +765,8 @@ DROP TABLE t1; # # MDEV-16054 simple json functions flatline cpu on garbage input. # -select json_array(1,uuid(),compress(5.140264e+307)); -json_array(1,uuid(),compress(5.140264e+307)) +select json_array(1,user(),compress(5.140264e+307)); +json_array(1,user(),compress(5.140264e+307)) NULL # # MDEV-16869 String functions don't respect character set of JSON_VALUE. diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test index 16f323a9a56..9a063adc2cb 100644 --- a/mysql-test/main/func_json.test +++ b/mysql-test/main/func_json.test @@ -429,7 +429,7 @@ DROP TABLE t1; --echo # MDEV-16054 simple json functions flatline cpu on garbage input. --echo # -select json_array(1,uuid(),compress(5.140264e+307)); +select json_array(1,user(),compress(5.140264e+307)); --echo # --echo # MDEV-16869 String functions don't respect character set of JSON_VALUE. diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 75abd9906cd..e9263fb6954 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -4279,6 +4279,7 @@ String *Item_func_compress::val_str(String *str) } str->length((uint32)new_size + 4); + str->set_charset(&my_charset_bin); return str; } |