[MDEV-6627] QUOTE() does not work well with unassigned characters Created: 2014-08-22  Updated: 2023-11-28

Status: Confirmed
Project: MariaDB Server
Component/s: None
Affects Version/s: 5.3.12, 5.5.39, 10.0.13
Fix Version/s: 10.4, 10.5, 10.6

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


 Description   

MariaDB [test]> SELECT HEX(_big5 0xC840), HEX(QUOTE(_big5 0xC840));
+-------------------+--------------------------+
| HEX(_big5 0xC840) | HEX(QUOTE(_big5 0xC840)) |
+-------------------+--------------------------+
| C840              | NULL                     |
+-------------------+--------------------------+
1 row in set (0.00 sec)

The result for in the second column is wrong.
The expected result is C840, similar to the first column.

The problem happens because Item_func_quote::val_str()
uses an mb_wc()..wc_mb() loop, which breaks and returns
null on unassigned characters.

The loop should be fixed to use a native non-Unicode API instead, e.g. ismbchar().


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