Skip to content

Commit 82c07fc

Browse files
committed
MDEV-23149 Server crashes in my_convert / ErrConvString::ptr / Item_char_typecast::check_truncation_with_warn
1 parent 47d0df6 commit 82c07fc

File tree

5 files changed

+17
-10
lines changed

5 files changed

+17
-10
lines changed

mysql-test/main/func_compress.result

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,6 @@ DROP TABLE t1;
193193
# End of 10.1 tests
194194
#
195195
#
196-
# Start of 10.2 tests
197-
#
198-
#
199196
# MDEV-10134 Add full support for DEFAULT
200197
#
201198
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
213210
100 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
214211
DROP TABLE t1;
215212
#
213+
# MDEV-23149 Server crashes in my_convert / ErrConvString::ptr / Item_char_typecast::check_truncation_with_warn
214+
#
215+
select 'foo' in (cast(compress('bar') as char(4)), 'qux');
216+
'foo' in (cast(compress('bar') as char(4)), 'qux')
217+
0
218+
Warnings:
219+
Warning 1292 Truncated incorrect CHAR(4) value: '\x03\x00\x00\x00x\x9CKJ,\x02\x00\x02]\x016'
220+
#
216221
# End of 10.2 tests
217222
#

mysql-test/main/func_compress.test

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,6 @@ DROP TABLE t1;
173173
--echo # End of 10.1 tests
174174
--echo #
175175

176-
--echo #
177-
--echo # Start of 10.2 tests
178-
--echo #
179-
180176
--echo #
181177
--echo # MDEV-10134 Add full support for DEFAULT
182178
--echo #
@@ -186,6 +182,11 @@ INSERT INTO t1 (a) VALUES (REPEAT('a',100));
186182
SELECT bl, a1 FROM t1;
187183
DROP TABLE t1;
188184

185+
--echo #
186+
--echo # MDEV-23149 Server crashes in my_convert / ErrConvString::ptr / Item_char_typecast::check_truncation_with_warn
187+
--echo #
188+
select 'foo' in (cast(compress('bar') as char(4)), 'qux');
189+
189190
--echo #
190191
--echo # End of 10.2 tests
191192
--echo #

mysql-test/main/func_json.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -765,8 +765,8 @@ DROP TABLE t1;
765765
#
766766
# MDEV-16054 simple json functions flatline cpu on garbage input.
767767
#
768-
select json_array(1,uuid(),compress(5.140264e+307));
769-
json_array(1,uuid(),compress(5.140264e+307))
768+
select json_array(1,user(),compress(5.140264e+307));
769+
json_array(1,user(),compress(5.140264e+307))
770770
NULL
771771
#
772772
# MDEV-16869 String functions don't respect character set of JSON_VALUE.

mysql-test/main/func_json.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ DROP TABLE t1;
429429
--echo # MDEV-16054 simple json functions flatline cpu on garbage input.
430430
--echo #
431431

432-
select json_array(1,uuid(),compress(5.140264e+307));
432+
select json_array(1,user(),compress(5.140264e+307));
433433

434434
--echo #
435435
--echo # MDEV-16869 String functions don't respect character set of JSON_VALUE.

sql/item_strfunc.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4279,6 +4279,7 @@ String *Item_func_compress::val_str(String *str)
42794279
}
42804280

42814281
str->length((uint32)new_size + 4);
4282+
str->set_charset(&my_charset_bin);
42824283
return str;
42834284
}
42844285

0 commit comments

Comments
 (0)