1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-23149 Server crashes in my_convert / ErrConvString::ptr / Item_char_typecast::check_truncation_with_warn

This commit is contained in:
Sergei Golubchik
2022-08-09 14:24:53 +02:00
parent 47d0df6ef0
commit 82c07fcabf
5 changed files with 17 additions and 10 deletions

View File

@ -193,9 +193,6 @@ DROP TABLE t1;
# End of 10.1 tests # End of 10.1 tests
# #
# #
# Start of 10.2 tests
#
#
# MDEV-10134 Add full support for DEFAULT # 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)); 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 100 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
DROP TABLE t1; 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 # End of 10.2 tests
# #

View File

@ -173,10 +173,6 @@ DROP TABLE t1;
--echo # End of 10.1 tests --echo # End of 10.1 tests
--echo # --echo #
--echo #
--echo # Start of 10.2 tests
--echo #
--echo # --echo #
--echo # MDEV-10134 Add full support for DEFAULT --echo # MDEV-10134 Add full support for DEFAULT
--echo # --echo #
@ -186,6 +182,11 @@ INSERT INTO t1 (a) VALUES (REPEAT('a',100));
SELECT bl, a1 FROM t1; SELECT bl, a1 FROM t1;
DROP TABLE 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 #
--echo # End of 10.2 tests --echo # End of 10.2 tests
--echo # --echo #

View File

@ -765,8 +765,8 @@ DROP TABLE t1;
# #
# MDEV-16054 simple json functions flatline cpu on garbage input. # MDEV-16054 simple json functions flatline cpu on garbage input.
# #
select json_array(1,uuid(),compress(5.140264e+307)); select json_array(1,user(),compress(5.140264e+307));
json_array(1,uuid(),compress(5.140264e+307)) json_array(1,user(),compress(5.140264e+307))
NULL NULL
# #
# MDEV-16869 String functions don't respect character set of JSON_VALUE. # MDEV-16869 String functions don't respect character set of JSON_VALUE.

View File

@ -429,7 +429,7 @@ DROP TABLE t1;
--echo # MDEV-16054 simple json functions flatline cpu on garbage input. --echo # MDEV-16054 simple json functions flatline cpu on garbage input.
--echo # --echo #
select json_array(1,uuid(),compress(5.140264e+307)); select json_array(1,user(),compress(5.140264e+307));
--echo # --echo #
--echo # MDEV-16869 String functions don't respect character set of JSON_VALUE. --echo # MDEV-16869 String functions don't respect character set of JSON_VALUE.

View File

@ -4279,6 +4279,7 @@ String *Item_func_compress::val_str(String *str)
} }
str->length((uint32)new_size + 4); str->length((uint32)new_size + 4);
str->set_charset(&my_charset_bin);
return str; return str;
} }