[MDEV-6569] CAST(binary AS CHAR(N)) can create a malformed result Created: 2014-08-13  Updated: 2022-11-03  Resolved: 2022-11-03

Status: Closed
Project: MariaDB Server
Component/s: Character Sets
Affects Version/s: 5.3.12, 5.5.39, 10.0.13
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None


 Description   

CAST from BINARY to CHAR does not check wel-formedness:

MariaDB [test]> SELECT CAST(0xFFFF AS CHAR(10) CHARACTER SET utf8) AS ch, HEX(CAST(0xFFFF AS CHAR(10) CHARACTER SET utf8)) AS hex;
+----+------+
| ch | hex  |
+----+------+
| ��   | FFFF |
+----+------+
1 row in set (0.00 sec)

The expected result would be to replace bad bytes to question
marks and produce a warning.



 Comments   
Comment by Sergei Golubchik [ 2022-11-03 ]

fixed before 10.3.37

Generated at Thu Feb 08 07:12:55 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.